Skip to content

Commit

Permalink
Renamed method and add enum.
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Labordus <[email protected]>
  • Loading branch information
Dennis Labordus committed Sep 14, 2022
1 parent db16185 commit f22f880
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.lfenergy.compas.scl.extensions.commons.CompasExtensionsField.SCL_FILE_TYPE;
import static org.lfenergy.compas.scl.extensions.commons.CompasExtensionsField.SCL_NAME;
import static org.lfenergy.compas.scl.extensions.commons.CompasExtensionsField.*;

class CompasExtensionsFieldTest {
@Test
void enum_WhenRetrievingTheFieldName_ThenTheCorrectStringIsReturned() {
assertEquals("SclName", SCL_NAME.getFieldName());
assertEquals("SclFileType", SCL_FILE_TYPE.getFieldName());
assertEquals("Labels", LABELS.getFieldName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Optional<TPrivate> getCompasPrivate(SCL scl) {
return Optional.empty();
}

public Optional<TCompasLabels> getLabels(TPrivate compasPrivate) {
public Optional<TCompasLabels> getCompasLabels(TPrivate compasPrivate) {
return getCompasValue(compasPrivate, LABELS, TCompasLabels.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,32 @@ void getCompasSclFileType_WhenCalledWithoutType_ThenNoTypeReturned() {
}

@Test
void getLabels_WhenCalledNullPassed_ThenNoLabelsReturned() {
var value = manager.getLabels(null);
void getCompasLabels_WhenCalledNullPassed_ThenNoLabelsReturned() {
var value = manager.getCompasLabels(null);

assertFalse(value.isPresent());
}

@Test
void getLabels_WhenCalledWithLabels_ThenLabelsReturned() {
void getCompasLabels_WhenCalledWithLabels_ThenLabelsReturned() {
var scl = readSCL("scl_with_compas_private.scd");
var compasPrivate = manager.getCompasPrivate(scl);

compasPrivate.ifPresentOrElse(tPrivate -> {
var labels = manager.getLabels(tPrivate);
var labels = manager.getCompasLabels(tPrivate);

assertTrue(labels.isPresent());
assertEquals("Label1", labels.get().getLabel().get(0));
}, () -> fail(COMPAS_PRIVATE_NOT_FOUND));
}

@Test
void getLabels_WhenCalledWithoutLabels_ThenNoLabelsReturned() {
void getCompasLabels_WhenCalledWithoutLabels_ThenNoLabelsReturned() {
var scl = readSCL("scl_without_labels_compas_private.scd");

var compasPrivate = manager.getCompasPrivate(scl);
compasPrivate.ifPresentOrElse(tPrivate -> {
var labels = manager.getLabels(tPrivate);
var labels = manager.getCompasLabels(tPrivate);

assertFalse(labels.isPresent());
}, () -> fail(COMPAS_PRIVATE_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Optional<String> getCompasSclName(TPrivate compasPrivate) {
return getCompasValue(compasPrivate, SCL_NAME, String.class);
}

public Optional<TCompasLabels> getLabels(TPrivate compasPrivate) {
public Optional<TCompasLabels> getCompasLabels(TPrivate compasPrivate) {
return getCompasValue(compasPrivate, LABELS, TCompasLabels.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,32 @@ void getCompasSclFileType_WhenCalledWithoutType_ThenNoTypeReturned() {
}

@Test
void getLabels_WhenCalledNullPassed_ThenNoLabelsReturned() {
var value = manager.getLabels(null);
void getCompasLabels_WhenCalledNullPassed_ThenNoLabelsReturned() {
var value = manager.getCompasLabels(null);

assertFalse(value.isPresent());
}

@Test
void getLabels_WhenCalledWithLabels_ThenLabelsReturned() {
void getCompasLabels_WhenCalledWithLabels_ThenLabelsReturned() {
var scl = readSCL("scl_with_compas_private.scd");
var compasPrivate = manager.getCompasPrivate(scl);

compasPrivate.ifPresentOrElse(tPrivate -> {
var labels = manager.getLabels(tPrivate);
var labels = manager.getCompasLabels(tPrivate);

assertTrue(labels.isPresent());
assertEquals("Label1", labels.get().getLabel().get(0));
}, () -> fail(COMPAS_PRIVATE_NOT_FOUND));
}

@Test
void getLabels_WhenCalledWithoutLabels_ThenNoLabelsReturned() {
void getCompasLabels_WhenCalledWithoutLabels_ThenNoLabelsReturned() {
var scl = readSCL("scl_without_labels_compas_private.scd");

var compasPrivate = manager.getCompasPrivate(scl);
compasPrivate.ifPresentOrElse(tPrivate -> {
var labels = manager.getLabels(tPrivate);
var labels = manager.getCompasLabels(tPrivate);

assertFalse(labels.isPresent());
}, () -> fail(COMPAS_PRIVATE_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Optional<SclFileType> getCompasSclFileType(TPrivate compasPrivate) {
return getCompasValue(compasPrivate, SCL_FILE_TYPE, SclFileType.class);
}

public Optional<TCompasLabels> getLabels(TPrivate compasPrivate) {
public Optional<TCompasLabels> getCompasLabels(TPrivate compasPrivate) {
return getCompasValue(compasPrivate, LABELS, TCompasLabels.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,32 +164,32 @@ void getCompasSclFileType_WhenCalledWithoutType_ThenNoTypeReturned() {
}

@Test
void getLabels_WhenCalledNullPassed_ThenNoLabelsReturned() {
var value = manager.getLabels(null);
void getCompasLabels_WhenCalledNullPassed_ThenNoLabelsReturned() {
var value = manager.getCompasLabels(null);

assertFalse(value.isPresent());
}

@Test
void getLabels_WhenCalledWithLabels_ThenLabelsReturned() {
void getCompasLabels_WhenCalledWithLabels_ThenLabelsReturned() {
var scl = readSCL("scl_with_compas_private.scd");
var compasPrivate = manager.getCompasPrivate(scl);

compasPrivate.ifPresentOrElse(tPrivate -> {
var labels = manager.getLabels(tPrivate);
var labels = manager.getCompasLabels(tPrivate);

assertTrue(labels.isPresent());
assertEquals("Label1", labels.get().getLabel().get(0));
}, () -> fail(COMPAS_PRIVATE_NOT_FOUND));
}

@Test
void getLabels_WhenCalledWithoutLabels_ThenNoLabelsReturned() {
void getCompasLabels_WhenCalledWithoutLabels_ThenNoLabelsReturned() {
var scl = readSCL("scl_without_labels_compas_private.scd");

var compasPrivate = manager.getCompasPrivate(scl);
compasPrivate.ifPresentOrElse(tPrivate -> {
var labels = manager.getLabels(tPrivate);
var labels = manager.getCompasLabels(tPrivate);

assertFalse(labels.isPresent());
}, () -> fail(COMPAS_PRIVATE_NOT_FOUND));
Expand Down

0 comments on commit f22f880

Please sign in to comment.