forked from Realhedin/topjava02
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilTest.java
More file actions
33 lines (27 loc) · 879 Bytes
/
UtilTest.java
File metadata and controls
33 lines (27 loc) · 879 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
31
32
33
package ru.javawebinar.topjava;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* GKislin
* 12.04.2015.
*/
public class UtilTest {
private static final List<Integer> ARRAY_LIST = Arrays.asList(1, 2, 3, 4, 5);
private static final List<Integer> LIST = new LinkedList<>(ARRAY_LIST);
private static final List<Integer> UNMODIFIABLE_LIST = Collections.unmodifiableList(LIST);
@Test(expected = UnsupportedOperationException.class)
public void testArrayListModify() throws Exception {
ARRAY_LIST.add(6);
}
@Test
public void testListModify() throws Exception {
LIST.add(6);
}
@Test(expected = UnsupportedOperationException.class)
public void testUnmodifiableListModify() throws Exception {
UNMODIFIABLE_LIST.add(6);
}
}