mirror of
https://github.com/apache/commons-collections.git
synced 2025-02-09 11:35:28 +00:00
Add AbstractMapTest.testForEach()
This commit is contained in:
parent
17aca847b1
commit
8d7a701b09
@ -37,6 +37,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import org.apache.commons.collections4.AbstractObjectTest;
|
import org.apache.commons.collections4.AbstractObjectTest;
|
||||||
import org.apache.commons.collections4.BulkTest;
|
import org.apache.commons.collections4.BulkTest;
|
||||||
@ -1114,6 +1115,21 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||||||
assertTrue(getMap().isEmpty());
|
assertTrue(getMap().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests {@link Map#forEach(java.util.function.BiConsumer)}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testForEach() {
|
||||||
|
resetFull();
|
||||||
|
AtomicInteger i = new AtomicInteger();
|
||||||
|
getMap().forEach((k, v) -> {
|
||||||
|
assertTrue(getMap().containsKey(k));
|
||||||
|
assertTrue(getMap().containsValue(v));
|
||||||
|
i.incrementAndGet();
|
||||||
|
});
|
||||||
|
assertEquals(i.get(), getMap().size());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare the current serialized form of the Map against the canonical version in SCM.
|
* Compare the current serialized form of the Map against the canonical version in SCM.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user