diff --git a/Personal/Test Driven Development/Hello World/src/main/java/hello/world/App.java b/Personal/Test Driven Development/Hello World/src/main/java/hello/world/App.java new file mode 100644 index 0000000..6486350 --- /dev/null +++ b/Personal/Test Driven Development/Hello World/src/main/java/hello/world/App.java @@ -0,0 +1,13 @@ +package hello.world; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println("Hello World!"); + } +} diff --git a/Personal/Test Driven Development/Hello World/src/main/java/hello/world/Greeting.java b/Personal/Test Driven Development/Hello World/src/main/java/hello/world/Greeting.java new file mode 100644 index 0000000..7143720 --- /dev/null +++ b/Personal/Test Driven Development/Hello World/src/main/java/hello/world/Greeting.java @@ -0,0 +1,17 @@ +package hello.world; + +public class Greeting { + String message; + + public Greeting() { + + } + + public Greeting(String message) { + this.message = message; + } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + +} diff --git a/Personal/Test Driven Development/Hello World/src/main/java/hello/world/HelloWorld.java b/Personal/Test Driven Development/Hello World/src/main/java/hello/world/HelloWorld.java new file mode 100644 index 0000000..9f638fc --- /dev/null +++ b/Personal/Test Driven Development/Hello World/src/main/java/hello/world/HelloWorld.java @@ -0,0 +1,12 @@ +package hello.world; + +/** + * Hello world! + * + */ +public class HelloWorld { + public static void main(String[] args) { + Greeting greeting = new Greeting("Hello World"); + System.out.println(greeting.getMessage()); + } +} diff --git a/Personal/Test Driven Development/Hello World/src/test/java/hello/world/HelloWorldTest.java b/Personal/Test Driven Development/Hello World/src/test/java/hello/world/HelloWorldTest.java new file mode 100644 index 0000000..a5a64f3 --- /dev/null +++ b/Personal/Test Driven Development/Hello World/src/test/java/hello/world/HelloWorldTest.java @@ -0,0 +1,25 @@ +package hello.world; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class HelloWorldTest { + /** + * Rigorous Test :-) + */ + @Test + public void greetingMessageShouldPass() { + Greeting greeting = new Greeting("Hello World"); + assertEquals("Hello World", greeting.getMessage()); + } + + @Test + public void greetingMessageShouldFail() { + Greeting greeting = new Greeting("Not Hello World"); + assertEquals("Hello World", greeting.getMessage()); + } +}