diff --git a/.gitignore b/.gitignore index 8a0a899..66e6eb4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ example3/build *.iws .idea/ out +target diff --git a/mastercrupt-maven/pom.xml b/mastercrupt-maven/pom.xml new file mode 100644 index 0000000..207a0ca --- /dev/null +++ b/mastercrupt-maven/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + mastercrupt + kata + 1.0-SNAPSHOT + + + UTF-8 + 1.8 + ${maven.compiler.source} + 5.4.2 + + + + + org.junit.jupiter + junit-jupiter + ${junit.jupiter.version} + test + + + + + + + maven-compiler-plugin + 3.8.0 + + + + + diff --git a/mastercrupt-maven/src/main/java/mastercrupt/Application.java b/mastercrupt-maven/src/main/java/mastercrupt/Application.java new file mode 100755 index 0000000..c27752c --- /dev/null +++ b/mastercrupt-maven/src/main/java/mastercrupt/Application.java @@ -0,0 +1,11 @@ +package mastercrupt; + +public class Application { + public void leet(String string, UI ui) { + ui.setLeeted(Leeter.leet(string)); + } + public static void main(String[] args) { + UI ui = new UI(); + System.out.println(ui.leetMessage(args[0])); + } +} \ No newline at end of file diff --git a/mastercrupt-maven/src/main/java/mastercrupt/Leeter.java b/mastercrupt-maven/src/main/java/mastercrupt/Leeter.java new file mode 100644 index 0000000..0106c8e --- /dev/null +++ b/mastercrupt-maven/src/main/java/mastercrupt/Leeter.java @@ -0,0 +1,7 @@ +package mastercrupt; + +public class Leeter { + public static String leet(String message) { + return message.replace('e', '3'); + } +} diff --git a/mastercrupt-maven/src/main/java/mastercrupt/UI.java b/mastercrupt-maven/src/main/java/mastercrupt/UI.java new file mode 100755 index 0000000..afd919e --- /dev/null +++ b/mastercrupt-maven/src/main/java/mastercrupt/UI.java @@ -0,0 +1,15 @@ +package mastercrupt; + +public class UI { + private Application application = new Application(); + private String leeted; + + public String leetMessage(String unLeeted) { + application.leet(unLeeted, this); + return "Leeted: " + leeted; + } + + public void setLeeted(String leeted) { + this.leeted = leeted; + } +} \ No newline at end of file diff --git a/mastercrupt-maven/src/test/java/mastercrupt/AcceptanceTest.java b/mastercrupt-maven/src/test/java/mastercrupt/AcceptanceTest.java new file mode 100755 index 0000000..522f247 --- /dev/null +++ b/mastercrupt-maven/src/test/java/mastercrupt/AcceptanceTest.java @@ -0,0 +1,12 @@ +package mastercrupt; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +public class AcceptanceTest { + @Test + public void testLeeting() { + UI ui = new UI(); + assertEquals("Leeted: S3cr3t", ui.leetMessage("Secret")); + } +}