@CollectionFeature.Require(SUPPORTS_ADD) @CollectionSize.Require(absent = ZERO) public void testAddAll_supportedSomePresent() { assertTrue( "addAll(somePresent) should return true", collection.addAll(MinimalCollection.of(e3(), e0()))); assertTrue("should contain " + e3(), collection.contains(e3())); assertTrue("should contain " + e0(), collection.contains(e0())); }
@CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) @CollectionSize.Require(absent = ZERO) public void testAddAllConcurrentWithIteration() { try { Iterator<E> iterator = collection.iterator(); assertTrue(collection.addAll(MinimalCollection.of(e3(), e0()))); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
@CollectionFeature.Require(SUPPORTS_ADD) public void testAddAll_supportedNonePresent() { assertTrue( "addAll(nonePresent) should return true", collection.addAll(createDisjointCollection())); expectAdded(e3(), e4()); }
@CollectionFeature.Require(absent = SUPPORTS_ADD) @CollectionSize.Require(absent = ZERO) public void testAddAll_unsupportedSomePresent() { try { collection.addAll(MinimalCollection.of(e3(), e0())); fail("addAll(somePresent) should throw"); } catch (UnsupportedOperationException expected) { } expectUnchanged(); }
@CollectionFeature.Require(absent = SUPPORTS_ADD) public void testAddAll_unsupportedNonePresent() { try { collection.addAll(createDisjointCollection()); fail("addAll(nonePresent) should throw"); } catch (UnsupportedOperationException expected) { } expectUnchanged(); expectMissing(e3(), e4()); }
@CollectionFeature.Require(SUPPORTS_ADD) @CollectionSize.Require(absent = ZERO) public void testAddAll_supportedSomePresent() { assertTrue( "addAll(somePresent) should return true", collection.addAll(MinimalCollection.of(e3(), e0()))); assertTrue("should contain " + e3(), collection.contains(e3())); assertTrue("should contain " + e0(), collection.contains(e0())); }
@CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) @CollectionSize.Require(absent = ZERO) public void testAddAllConcurrentWithIteration() { try { Iterator<E> iterator = collection.iterator(); assertTrue(collection.addAll(MinimalCollection.of(e3(), e0()))); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
@CollectionFeature.Require(SUPPORTS_ADD) public void testAddAll_supportedNonePresent() { assertTrue( "addAll(nonePresent) should return true", collection.addAll(createDisjointCollection())); expectAdded(e3(), e4()); }
@CollectionFeature.Require(absent = SUPPORTS_ADD) @CollectionSize.Require(absent = ZERO) public void testAddAll_unsupportedSomePresent() { try { collection.addAll(MinimalCollection.of(e3(), e0())); fail("addAll(somePresent) should throw"); } catch (UnsupportedOperationException expected) { } expectUnchanged(); }
@CollectionFeature.Require(absent = SUPPORTS_ADD) public void testAddAll_unsupportedNonePresent() { try { collection.addAll(createDisjointCollection()); fail("addAll(nonePresent) should throw"); } catch (UnsupportedOperationException expected) { } expectUnchanged(); expectMissing(e3(), e4()); }