@CollectionFeature.Require( value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES}, absent = RESTRICTS_ELEMENTS ) public void testSetCount_addNull_nullSupported() { assertSetCount(null, 1); }
@CollectionFeature.Require(ALLOWS_NULL_VALUES) public void testSetCount_noOpNull_nullSupported() { try { assertSetCount(null, 0); } catch (UnsupportedOperationException tolerated) { } }
@CollectionFeature.Require(absent = ALLOWS_NULL_VALUES) public void testSetCount_noOpNull_nullUnsupported() { try { assertSetCount(null, 0); } catch (NullPointerException | UnsupportedOperationException tolerated) { } }
private void assertOneToOne() { assertSetCount(e0(), 1); }
private void assertZeroToZero() { assertSetCount(e3(), 0); }
@CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) public void testSetCountZeroToOneConcurrentWithIteration() { try { Iterator<E> iterator = collection.iterator(); assertSetCount(e3(), 1); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
private void assertThreeToThree() { initThreeCopies(); assertSetCount(e0(), 3); }
@CollectionFeature.Require(SUPPORTS_ADD) public void testSetCount_zeroToOne_supported() { assertSetCount(e3(), 1); }
@CollectionFeature.Require(SUPPORTS_ADD) public void testSetCount_zeroToThree_supported() { assertSetCount(e3(), 3); }
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) @CollectionSize.Require(absent = ZERO) public void testSetCountOneToZeroConcurrentWithIteration() { try { Iterator<E> iterator = collection.iterator(); assertSetCount(e0(), 0); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
@CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) public void testSetCountZeroToOneConcurrentWithEntrySetIteration() { try { Iterator<Entry<E>> iterator = getMultiset().entrySet().iterator(); assertSetCount(e3(), 1); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
@CollectionSize.Require(absent = ZERO) @CollectionFeature.Require(ALLOWS_NULL_VALUES) public void testSetCount_existingNoNopNull_nullSupported() { initCollectionWithNullElement(); try { assertSetCount(null, 1); } catch (UnsupportedOperationException tolerated) { } }
@CollectionSize.Require(absent = ZERO) @CollectionFeature.Require(SUPPORTS_REMOVE) public void testSetCount_oneToZero_supported() { assertSetCount(e0(), 0); }
@CollectionSize.Require(absent = ZERO) @CollectionFeature.Require(SUPPORTS_ADD) public void testSetCount_oneToThree_supported() { assertSetCount(e0(), 3); }
@CollectionSize.Require(absent = ZERO) @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES}) public void testSetCount_removeNull_nullSupported() { initCollectionWithNullElement(); assertSetCount(null, 0); }
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) @CollectionSize.Require(absent = ZERO) public void testSetCountOneToZeroConcurrentWithEntrySetIteration() { try { Iterator<Entry<E>> iterator = getMultiset().entrySet().iterator(); assertSetCount(e0(), 0); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
@CollectionSize.Require(SEVERAL) @CollectionFeature.Require(SUPPORTS_REMOVE) public void testSetCount_threeToZero_supported() { initThreeCopies(); assertSetCount(e0(), 0); }
@CollectionSize.Require(SEVERAL) @CollectionFeature.Require(SUPPORTS_REMOVE) public void testSetCount_threeToOne_supported() { initThreeCopies(); assertSetCount(e0(), 1); }
@CollectionFeature.Require(absent = ALLOWS_NULL_VALUES) public void testSetCount_noOpNull_nullUnsupported() { try { assertSetCount(null, 0); } catch (NullPointerException tolerated) { } catch (UnsupportedOperationException tolerated) { } }
@CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION}) public void testSetCountZeroToOneConcurrentWithIteration() { try { Iterator<E> iterator = collection.iterator(); assertSetCount(e3(), 1); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }