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
30 lines (23 loc) · 756 Bytes
/
ListTests.java
File metadata and controls
30 lines (23 loc) · 756 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
30
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.*;
import java.util.ArrayList;
public class ListTests {
@Test
public void testfilter(){
StringChecker sc = new StringChecker() {
public boolean checkString(String s){
return s.length() < 8;
}
};
ArrayList<String> list = new ArrayList<>();
list.add("Pineapple");
list.add("Apple");
list.add("Orange");
List<String> newList = ListExamples.filter(list, sc);
ArrayList<String> expected = new ArrayList<>();
expected.add("Apple");
expected.add("Orange");
assertArrayEquals(expected.toArray(), newList.toArray());
}
}