lots of exercises in java... from https://github.com/exercism/java

HelloWorldTest.java 684B

1234567891011121314151617181920212223242526272829
  1. import org.junit.Test;
  2. import org.junit.Ignore;
  3. import static org.junit.Assert.assertEquals;
  4. public class HelloWorldTest {
  5. @Test
  6. public void helloNoName() {
  7. assertEquals("Hello, World!", HelloWorld.hello(""));
  8. assertEquals("Hello, World!", HelloWorld.hello(null));
  9. }
  10. @Test
  11. public void emptyStringIsComparedByValue() {
  12. assertEquals("Hello, World!", HelloWorld.hello(new String("")));
  13. }
  14. @Test
  15. public void helloSampleName() {
  16. assertEquals("Hello, Alice!", HelloWorld.hello("Alice"));
  17. }
  18. @Test
  19. public void helloAnotherSampleName() {
  20. assertEquals("Hello, Bob!", HelloWorld.hello("Bob"));
  21. }
  22. }