private void putAll(Iterable<Entry<K, V>> entries) { Map<K, V> map = new LinkedHashMap<>(); for (Entry<K, V> entry : entries) { map.put(entry.getKey(), entry.getValue()); } getMap().putAll(map); }
@MapFeature.Require(SUPPORTS_PUT) public void testPutAll_nullCollectionReference() { try { getMap().putAll(null); fail("putAll(null) should throw NullPointerException"); } catch (NullPointerException expected) { } }
@MapFeature.Require(absent = SUPPORTS_PUT) public void testPutAll_unsupportedNothing() { try { getMap().putAll(emptyMap()); } catch (UnsupportedOperationException tolerated) { } expectUnchanged(); }
@MapFeature.Require(SUPPORTS_PUT) public void testPutAll_supportedNothing() { getMap().putAll(emptyMap()); expectUnchanged(); }
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT}) @CollectionSize.Require(absent = ZERO) public void testPutAllSomePresentConcurrentWithEntrySetIteration() { try { Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator(); putAll(MinimalCollection.of(e3(), e0())); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
private void putAll(Iterable<Entry<K, V>> entries) { Map<K, V> map = new LinkedHashMap<>(); for (Entry<K, V> entry : entries) { map.put(entry.getKey(), entry.getValue()); } getMap().putAll(map); }
private void putAll(Iterable<Entry<K, V>> entries) { Map<K, V> map = new LinkedHashMap<K, V>(); for (Entry<K, V> entry : entries) { map.put(entry.getKey(), entry.getValue()); } getMap().putAll(map); }
@MapFeature.Require(SUPPORTS_PUT) public void testPutAll_nullCollectionReference() { try { getMap().putAll(null); fail("putAll(null) should throw NullPointerException"); } catch (NullPointerException expected) { } }
@MapFeature.Require(SUPPORTS_PUT) public void testPutAll_nullCollectionReference() { try { getMap().putAll(null); fail("putAll(null) should throw NullPointerException"); } catch (NullPointerException expected) { } }
@MapFeature.Require(SUPPORTS_PUT) public void testPutAll_supportedNothing() { getMap().putAll(emptyMap()); expectUnchanged(); }
@MapFeature.Require(absent = SUPPORTS_PUT) public void testPutAll_unsupportedNothing() { try { getMap().putAll(emptyMap()); } catch (UnsupportedOperationException tolerated) { } expectUnchanged(); }
@MapFeature.Require(SUPPORTS_PUT) public void testPutAll_supportedNothing() { getMap().putAll(emptyMap()); expectUnchanged(); }
@MapFeature.Require(absent = SUPPORTS_PUT) public void testPutAll_unsupportedNothing() { try { getMap().putAll(emptyMap()); } catch (UnsupportedOperationException tolerated) { } expectUnchanged(); }
@MapFeature.Require({ FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT }) @CollectionSize.Require(absent = ZERO) public void testPutAllSomePresentConcurrentWithEntrySetIteration() { try { Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator(); putAll(MinimalCollection.of(samples.e3, samples.e0)); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT}) @CollectionSize.Require(absent = ZERO) public void testPutAllSomePresentConcurrentWithEntrySetIteration() { try { Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator(); putAll(MinimalCollection.of(e3(), e0())); iterator.next(); fail("Expected ConcurrentModificationException"); } catch (ConcurrentModificationException expected) { // success } }