diff --git a/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java b/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java index c433c93d7..c626ff951 100644 --- a/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java +++ b/src/test/java/org/apache/commons/collections4/multiset/UnmodifiableMultiSetTest.java @@ -92,6 +92,40 @@ public class UnmodifiableMultiSetTest extends AbstractMultiSetTest { //----------------------------------------------------------------------- + public void testAdd() { + final MultiSet multiset = makeFullCollection(); + final MultiSet unmodifiableMultiSet = UnmodifiableMultiSet.unmodifiableMultiSet(multiset); + try { + unmodifiableMultiSet.add( (E)"One",1); + fail(); + } catch (final UnsupportedOperationException ex) {} + } + + public void testRemove() { + final MultiSet multiset = makeFullCollection(); + final MultiSet unmodifiableMultiSet = UnmodifiableMultiSet.unmodifiableMultiSet(multiset); + try { + unmodifiableMultiSet.remove( (E)"One",1); + fail(); + } catch (final UnsupportedOperationException ex) {} + } + + public void testSetCount() { + final MultiSet multiset = makeFullCollection(); + final MultiSet unmodifiableMultiSet = UnmodifiableMultiSet.unmodifiableMultiSet(multiset); + try { + unmodifiableMultiSet.setCount( (E)"One",2); + fail(); + } catch (final UnsupportedOperationException ex) {} + } + + public void testEntrySet() { + final MultiSet multiset = makeFullCollection(); + final MultiSet unmodifiableMultiSet = UnmodifiableMultiSet.unmodifiableMultiSet(multiset); + assertSame( unmodifiableMultiSet.entrySet().size(),multiset.entrySet().size()); + } + //----------------------------------------------------------------------- + @Override public String getCompatibilityVersion() { return "4.1";