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

HelloWorldTest.java 533B

1234567891011121314151617181920212223
  1. import org.junit.Test;
  2. import static org.junit.Assert.assertEquals;
  3. public class HelloWorldTest {
  4. @Test
  5. public void helloNoName() {
  6. assertEquals("Hello, World!", HelloWorld.hello(""));
  7. assertEquals("Hello, World!", HelloWorld.hello(null));
  8. }
  9. @Test
  10. public void helloSampleName() {
  11. assertEquals("Hello, Alice!", HelloWorld.hello("Alice"));
  12. }
  13. @Test
  14. public void helloAnotherSampleName() throws Exception {
  15. assertEquals("Hello, Bob!", HelloWorld.hello("Bob"));
  16. }
  17. }