This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
commit 42ae7b98c2f6d39af844b7bd48d0a71bde3d308f Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Mar 31 11:06:49 2024 -0400 Rework test fixtures Next, grow the amount of data tested to find bugs in the tests with non-repeatable map ordering --- .../multimap/AbstractMultiValuedMapTest.java | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java index 4a24146a5..15f490d70 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -557,7 +557,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes } public int getSampleKeySize() { - return 3; + return 256; } public int getSampleTotalValueCount() { @@ -1037,19 +1037,18 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes } if (!isHashSetValue() && isAddSupported()) { assertTrue(it.hasNext()); - final int maxK = getSampleKeySize(); - final int maxV = getSampleCountPerKey(); - for (int k = 0; k < maxK; k++) { - final Object key = makeKey(k); - for (int v = 0; v < maxV; v++) { - final Object value = makeValue(k, v); - assertTrue(it.hasNext()); - assertEquals(key, it.next()); - assertEquals(key, it.getKey()); - assertEquals(value, it.getValue()); - assertThrows(UnsupportedOperationException.class, () -> it.setValue((V) "threetrois")); - } + final MultiValuedMap<K, V> dejaVu = makeObject(); + while (it.hasNext()) { + final K next = it.next(); + assertNotNull(next); + final K itKey = it.getKey(); + assertEquals(next, itKey); + final V itValue = it.getValue(); + dejaVu.put(itKey, itValue); + assertThrows(UnsupportedOperationException.class, () -> it.setValue((V) "threetrois")); } + assertEquals(map, dejaVu); + assertEquals(dejaVu, map); assertThrows(UnsupportedOperationException.class, () -> it.setValue((V) "threetrois")); } }