From f22f88004529b6808259459bbb097b88aa6d2318 Mon Sep 17 00:00:00 2001 From: Dennis Labordus Date: Wed, 14 Sep 2022 15:36:13 +0200 Subject: [PATCH] Renamed method and add enum. Signed-off-by: Dennis Labordus --- .../commons/CompasExtensionsFieldTest.java | 4 ++-- .../scl2003/commons/CompasExtensionsManager.java | 2 +- .../scl2003/commons/CompasExtensionsManagerTest.java | 12 ++++++------ .../scl2007b/commons/CompasExtensionsManager.java | 2 +- .../commons/CompasExtensionsManagerTest.java | 12 ++++++------ .../scl2007b4/commons/CompasExtensionsManager.java | 2 +- .../commons/CompasExtensionsManagerTest.java | 12 ++++++------ 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/scl-extension/src/test/java/org/lfenergy/compas/scl/extensions/commons/CompasExtensionsFieldTest.java b/scl-extension/src/test/java/org/lfenergy/compas/scl/extensions/commons/CompasExtensionsFieldTest.java index bcbfe9d..c67d760 100644 --- a/scl-extension/src/test/java/org/lfenergy/compas/scl/extensions/commons/CompasExtensionsFieldTest.java +++ b/scl-extension/src/test/java/org/lfenergy/compas/scl/extensions/commons/CompasExtensionsFieldTest.java @@ -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()); } } diff --git a/scl2003/src/main/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManager.java b/scl2003/src/main/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManager.java index 83376ff..ef8826f 100644 --- a/scl2003/src/main/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManager.java +++ b/scl2003/src/main/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManager.java @@ -27,7 +27,7 @@ public Optional getCompasPrivate(SCL scl) { return Optional.empty(); } - public Optional getLabels(TPrivate compasPrivate) { + public Optional getCompasLabels(TPrivate compasPrivate) { return getCompasValue(compasPrivate, LABELS, TCompasLabels.class); } diff --git a/scl2003/src/test/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManagerTest.java b/scl2003/src/test/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManagerTest.java index 34e021d..0b35a24 100644 --- a/scl2003/src/test/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManagerTest.java +++ b/scl2003/src/test/java/org/lfenergy/compas/scl2003/commons/CompasExtensionsManagerTest.java @@ -164,19 +164,19 @@ 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)); @@ -184,12 +184,12 @@ void getLabels_WhenCalledWithLabels_ThenLabelsReturned() { } @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)); diff --git a/scl2007b/src/main/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManager.java b/scl2007b/src/main/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManager.java index cb64acf..e4b48a2 100644 --- a/scl2007b/src/main/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManager.java +++ b/scl2007b/src/main/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManager.java @@ -42,7 +42,7 @@ public Optional getCompasSclName(TPrivate compasPrivate) { return getCompasValue(compasPrivate, SCL_NAME, String.class); } - public Optional getLabels(TPrivate compasPrivate) { + public Optional getCompasLabels(TPrivate compasPrivate) { return getCompasValue(compasPrivate, LABELS, TCompasLabels.class); } diff --git a/scl2007b/src/test/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManagerTest.java b/scl2007b/src/test/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManagerTest.java index b343c06..410bafa 100644 --- a/scl2007b/src/test/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManagerTest.java +++ b/scl2007b/src/test/java/org/lfenergy/compas/scl2007b/commons/CompasExtensionsManagerTest.java @@ -164,19 +164,19 @@ 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)); @@ -184,12 +184,12 @@ void getLabels_WhenCalledWithLabels_ThenLabelsReturned() { } @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)); diff --git a/scl2007b4/src/main/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManager.java b/scl2007b4/src/main/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManager.java index c028a62..e54da46 100644 --- a/scl2007b4/src/main/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManager.java +++ b/scl2007b4/src/main/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManager.java @@ -35,7 +35,7 @@ public Optional getCompasSclFileType(TPrivate compasPrivate) { return getCompasValue(compasPrivate, SCL_FILE_TYPE, SclFileType.class); } - public Optional getLabels(TPrivate compasPrivate) { + public Optional getCompasLabels(TPrivate compasPrivate) { return getCompasValue(compasPrivate, LABELS, TCompasLabels.class); } diff --git a/scl2007b4/src/test/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManagerTest.java b/scl2007b4/src/test/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManagerTest.java index a603999..b4ea8fb 100644 --- a/scl2007b4/src/test/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManagerTest.java +++ b/scl2007b4/src/test/java/org/lfenergy/compas/scl2007b4/commons/CompasExtensionsManagerTest.java @@ -164,19 +164,19 @@ 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)); @@ -184,12 +184,12 @@ void getLabels_WhenCalledWithLabels_ThenLabelsReturned() { } @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));