diff options
Diffstat (limited to 'src/test/java')
4 files changed, 50 insertions, 12 deletions
diff --git a/src/test/java/ch/fhnw/thga/gradleplugins/Builder.java b/src/test/java/ch/fhnw/thga/gradleplugins/Builder.java index df070a2..d379013 100644 --- a/src/test/java/ch/fhnw/thga/gradleplugins/Builder.java +++ b/src/test/java/ch/fhnw/thga/gradleplugins/Builder.java @@ -15,7 +15,7 @@ public interface Builder { Builder compilerFlags(String compilerFlags); - Builder replSource(String replSource); + Builder replModule(String replModule); FregeDTO build(); } diff --git a/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTO.java b/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTO.java index e092eac..bea1e81 100644 --- a/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTO.java +++ b/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTO.java @@ -14,7 +14,7 @@ public class FregeDTO { public final String outputDir; public final String mainModule; public final String compilerFlags; - public final String replSource; + public final String replModule; public FregeDTO( String version, @@ -24,7 +24,7 @@ public class FregeDTO { String outputDir, String mainModule, String compilerFlags, - String replSource) { + String replModule) { this.version = version; this.release = release; this.compilerDownloadDir = compilerDownloadDir; @@ -32,7 +32,7 @@ public class FregeDTO { this.outputDir = outputDir; this.mainModule = mainModule; this.compilerFlags = compilerFlags; - this.replSource = replSource; + this.replModule = replModule; } public String getVersion() { @@ -63,8 +63,8 @@ public class FregeDTO { return compilerFlags; } - public String getReplSource() { - return replSource; + public String getReplModule() { + return replModule; } private String getFieldValue(Field field) { diff --git a/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTOBuilder.java b/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTOBuilder.java index d7fe9f1..58e8396 100644 --- a/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTOBuilder.java +++ b/src/test/java/ch/fhnw/thga/gradleplugins/FregeDTOBuilder.java @@ -8,7 +8,7 @@ public final class FregeDTOBuilder implements Builder { private String outputDir = ""; private String mainModule = ""; private String compilerFlags = ""; - private String replSource = ""; + private String replModule = ""; private FregeDTOBuilder() {} @@ -65,9 +65,9 @@ public final class FregeDTOBuilder implements Builder { } @Override - public Builder replSource(String replSource) + public Builder replModule(String replModule) { - this.replSource = replSource; + this.replModule = replModule; return this; } @@ -80,6 +80,6 @@ public final class FregeDTOBuilder implements Builder { outputDir, mainModule, compilerFlags, - replSource); + replModule); } } diff --git a/src/test/java/ch/fhnw/thga/gradleplugins/SharedTaskLogicTest.java b/src/test/java/ch/fhnw/thga/gradleplugins/SharedTaskLogicTest.java index 6f10d70..bb353a8 100644 --- a/src/test/java/ch/fhnw/thga/gradleplugins/SharedTaskLogicTest.java +++ b/src/test/java/ch/fhnw/thga/gradleplugins/SharedTaskLogicTest.java @@ -1,14 +1,52 @@ package ch.fhnw.thga.gradleplugins; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static ch.fhnw.thga.gradleplugins.SharedTaskLogic.extractClassNameFromFregeModuleName; + import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; +import net.jqwik.api.Example; +import net.jqwik.api.ForAll; +import net.jqwik.api.Property; + @TestInstance(Lifecycle.PER_CLASS) public class SharedTaskLogicTest { - @Test + @Example void given_valid_frege_module_name_then_can_extract_class_name() { + assertEquals( + extractClassNameFromFregeModuleName("ch.fhnw.thga.Completion"), + "Completion" + ); + } + + @Example + void given_empty_frege_module_name_then_returns_empty_string() + { + assertEquals( + extractClassNameFromFregeModuleName(""), + "" + ); + } + + @Example + void module_name_without_a_package_equals_class_name() + { + assertEquals( + extractClassNameFromFregeModuleName("Completion"), + "Completion" + ); + } + + @Property + void class_name_is_the_suffix_of_the_full_module_name( + @ForAll String aString) + { + String expectedFregeClassName = "Completion"; + assertEquals( + extractClassNameFromFregeModuleName(String.join(".", expectedFregeClassName)), + expectedFregeClassName); } }
\ No newline at end of file |