RemoveMiddleCharacterTest.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package rocks.zipcode.quiz5.arrays.arrayutils;
  2. import org.junit.Assert;
  3. import org.junit.Test;
  4. import rocks.zipcode.quiz5.arrays.ArrayUtils;
  5. public class RemoveMiddleCharacterTest {
  6. @Test
  7. public void test1() {
  8. // given
  9. String[] expected = {"The", "Brown"};
  10. String[] input = {"The", "Quick", "Brown"};
  11. test(expected, input);
  12. }
  13. @Test
  14. public void test2() {
  15. // given
  16. String[] expected = {"The", "Quick", "Fox", "Jumps"};
  17. String[] input = {"The", "Quick", "Brown", "Fox", "Jumps"};
  18. test(expected, input);
  19. }
  20. @Test
  21. public void test3() {
  22. // given
  23. String[] expected = {"The", "Quick", "Brown", "Jumps", "Over", "The"};
  24. String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The"};
  25. test(expected, input);
  26. }
  27. @Test
  28. public void test4() {
  29. // given
  30. String[] expected = {"The", "Quick", "Brown", "Fox", "Over", "The", "Lazy", "Dog"};
  31. String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"};
  32. test(expected, input);
  33. }
  34. private void test(String[] expected, String[] input) {
  35. // when
  36. String[] actual = ArrayUtils.removeMiddleElement(input);
  37. //then
  38. Assert.assertArrayEquals(expected, actual);
  39. }
  40. }