forked from ucsd-cse15l-f23/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListTests.java
More file actions
28 lines (23 loc) · 881 Bytes
/
Copy pathListTests.java
File metadata and controls
28 lines (23 loc) · 881 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
import static org.junit.Assert.*;
import org.junit.*;
import java.util.*;
/*public class StringThing implements StringChecker{
boolean checkString(String s){
return s.length() > 3;
}
}*/
public class ListTests {
@Test
public void testReverseInPlace() {
List<String> list = Arrays.asList("cookie", "is", "number", "1", "in", "every", "way", "possible");
List<String> ans = Arrays.asList("cookie", "number", "every", "possible");
assertEquals(ans, ListExamples.filter(list, new StringThing()));
}
@Test
public void testMerge(){
List<String> list1 = Arrays.asList("carrot", "potato", "tomato");
List<String> list2 = Arrays.asList("chicken", "turkey", "wombat");
List<String> ans = Arrays.asList("carrot", "chicken", "potato", "tomato", "turkey", "wombat");
assertEquals(ans, ListExamples.merge(list1, list2));
}
}