forked from ucsd-cse15l-w23/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListTests.java
More file actions
38 lines (32 loc) · 1.05 KB
/
ListTests.java
File metadata and controls
38 lines (32 loc) · 1.05 KB
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.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.*;
public class ListTests {
@Test
public void testFilter(){
List<String> input = new ArrayList<>();
input.add("Hello");
input.add("World");
input.add("Uday");
List<String> expected = new ArrayList<>();
expected.add("Hello"); expected.add("World");
StringChecker sc = new StringCheck("l");
assertEquals(expected, ListExamples.filter(input, sc));
}
@Test
public void testMerge(){
List<String> input1 = new ArrayList<>();
input1.add("1");
input1.add("4");
input1.add("5");
List<String> input2 = new ArrayList<>();
input2.add("2");
input2.add("3");
input2.add("7");
List<String> expected = new ArrayList<>();
expected.add("1");expected.add("2");expected.add("3");
expected.add("4");expected.add("5");expected.add("7");
assertEquals(expected, ListExamples.merge(input1, input2));
}
}