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

AtbashTest.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import org.junit.Test;
  2. import org.junit.runner.RunWith;
  3. import org.junit.runners.Parameterized;
  4. import java.util.Arrays;
  5. import java.util.Collection;
  6. import static org.junit.Assert.assertEquals;
  7. @RunWith(Parameterized.class)
  8. public class AtbashTest {
  9. private String input;
  10. private String expectedOutput;
  11. @Parameterized.Parameters
  12. public static Collection<Object[]> data() {
  13. return Arrays.asList(new Object[][]{
  14. {"no", "ml"},
  15. {"yes", "bvh"},
  16. {"OMG", "lnt"},
  17. {"mindblowingly", "nrmwy oldrm tob"},
  18. {"Testing, 1 2 3, testing.", "gvhgr mt123 gvhgr mt"},
  19. {"Truth is fiction.", "gifgs rhurx grlm"},
  20. {"The quick brown fox jumps over the lazy dog.", "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"}
  21. });
  22. }
  23. public AtbashTest(String input, String expectedOutput) {
  24. this.input = input;
  25. this.expectedOutput = expectedOutput;
  26. }
  27. @Test
  28. public void test() {
  29. assertEquals(expectedOutput, Atbash.encode(input));
  30. }
  31. }