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