forked from ucsd-cse15l-f22/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListTests.java
More file actions
29 lines (27 loc) · 867 Bytes
/
ListTests.java
File metadata and controls
29 lines (27 loc) · 867 Bytes
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
import static org.junit.Assert.*;
import org.junit.*;
import java.util.*;
public class ListTests {
class len5sc implements StringChecker{
public boolean checkString(String s){
return s.length()>5;
}
}
@Test
public void scEmpty(){
assertEquals(new ArrayList<>(), ListExamples.filter(new ArrayList<String>(), new len5sc() ));
}
@Test
public void oneSc(){
ArrayList a = new ArrayList<String>();
a.add("111111");
a.add( "abcdef");
assertEquals(a, ListExamples.filter(a, new len5sc() ));
}
@Test
public void basicMerge(){
ArrayList a = new ArrayList<String>(List.of("a","c","e"));
ArrayList b = new ArrayList<String>(List.of("b", "z"));
assertEquals(new ArrayList<String>(List.of("a","b","c","e", "z")), ListExamples.merge(a, b));
}
}