Add Hello World Project With TDD Frameworks

master
Hammy 4 years ago
parent 960e584638
commit 9f9a3f68d4

@ -0,0 +1,13 @@
package hello.world;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println("Hello World!");
}
}

@ -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; }
}

@ -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());
}
}

@ -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());
}
}
Loading…
Cancel
Save