Merge pull request #6024 from amit2103/BAEL-10836

[BAEL-10836] - Removed CollectionsEmpty from core-java-collections mo…
This commit is contained in:
Loredana Crusoveanu 2018-12-29 21:34:55 +02:00 committed by GitHub
commit 99774f8730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 26 deletions

View File

@ -1,26 +0,0 @@
package org.baeldung.java.collections;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
class CollectionsEmpty {
@Test
public void givenArrayList_whenAddingElement_addsNewElement() {
ArrayList<String> mutableList = new ArrayList<>();
mutableList.add("test");
Assert.assertEquals(mutableList.size(), 1);
Assert.assertEquals(mutableList.get(0), "test");
}
@Test(expected = UnsupportedOperationException.class)
public void givenCollectionsEmptyList_whenAddingElement_throwsUnsupportedOperationException() {
List<String> immutableList = Collections.emptyList();
immutableList.add("test");
}
}