minor java collections work
This commit is contained in:
parent
22ebf4a218
commit
62fd8f8978
@ -35,6 +35,13 @@ public class CoreJavaUnitTest {
|
|||||||
unmodifiableList.add("four");
|
unmodifiableList.add("four");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = UnsupportedOperationException.class)
|
||||||
|
public final void givenUsingGuavaBuilder_whenUnmodifiableListIsCreatedFromOriginal_thenNoLongerModifiable() {
|
||||||
|
final List<String> list = new ArrayList<String>(Arrays.asList("one", "two", "three"));
|
||||||
|
final ImmutableList<Object> unmodifiableList = ImmutableList.builder().addAll(list).build();
|
||||||
|
unmodifiableList.add("four");
|
||||||
|
}
|
||||||
|
|
||||||
@Test(expected = UnsupportedOperationException.class)
|
@Test(expected = UnsupportedOperationException.class)
|
||||||
public final void givenUsingCommonsCollections_whenUnmodifiableListIsCreatedFromOriginal_thenNoLongerModifiable() {
|
public final void givenUsingCommonsCollections_whenUnmodifiableListIsCreatedFromOriginal_thenNoLongerModifiable() {
|
||||||
final List<String> list = new ArrayList<String>(Arrays.asList("one", "two", "three"));
|
final List<String> list = new ArrayList<String>(Arrays.asList("one", "two", "three"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user