minor java collections work

This commit is contained in:
eugenp 2013-12-24 16:59:03 +02:00
parent 22ebf4a218
commit 62fd8f8978
1 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,13 @@ public class CoreJavaUnitTest {
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)
public final void givenUsingCommonsCollections_whenUnmodifiableListIsCreatedFromOriginal_thenNoLongerModifiable() {
final List<String> list = new ArrayList<String>(Arrays.asList("one", "two", "three"));