forked from ucsd-cse15l-w23/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListTests.java
38 lines (33 loc) · 1.1 KB
/
ListTests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import static org.junit.Assert.assertArrayEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.*;
public class ListTests implements StringChecker {
@Test
public void testFilter() {
List<String> input1 = new ArrayList<String>();
input1.add("kit");
input1.add("eirene");
input1.add("joga");
input1.add("blue");
input1.add("wreevo");
assertArrayEquals(input1.toArray(), (ListExamples.filter(input1, new StringChecker())).toArray());
}
@Test
public void testMerge() {
List<String> input1 = new ArrayList<String>();
List<String> input2 = new ArrayList<String>();
input1.add("kit");
input2.add("eirene");
input1.add("joga");
input2.add("blue");
input1.add("wreevo");
List<String> output = new ArrayList<String>();
output.add("blue");
output.add("eirene");
output.add("joga");
output.add("kit");
output.add("wreevo");
assertArrayEquals(output.toArray(), (ListExamples.merge(input1, input2)).toArray());
}
}