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

ScrabbleScoreTest.java 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 ScrabbleScoreTest {
  9. private String input;
  10. private int expectedOutput;
  11. @Parameterized.Parameters
  12. public static Collection<Object[]> data() {
  13. return Arrays.asList(new Object[][]{
  14. {"", 0},
  15. {" \t\n", 0},
  16. {null, 0},
  17. {"a", 1},
  18. {"f", 4},
  19. {"street", 6},
  20. {"quirky", 22},
  21. {"oxyphenbutazone", 41},
  22. {"alacrity", 13},
  23. });
  24. }
  25. public ScrabbleScoreTest(String input, int expectedOutput) {
  26. this.input = input;
  27. this.expectedOutput = expectedOutput;
  28. }
  29. @Test
  30. public void test() {
  31. Scrabble scrabble = new Scrabble(input);
  32. assertEquals(expectedOutput, scrabble.getScore());
  33. }
  34. }