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 8cae45185329a28d2f27bc96d6e7d94659f7b8c8
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Mar 31 10:26:47 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       | 35 +++++++++-------------
 1 file changed, 14 insertions(+), 21 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 38beefda5..1daf23195 100644
--- 
a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
+++ 
b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
@@ -1030,33 +1030,26 @@ public abstract class AbstractMultiValuedMapTest<K, V> 
extends AbstractObjectTes
     public void testMultiValuedMapIterator() {
         final MultiValuedMap<K, V> map = makeFullMap();
         final MapIterator<K, V> it = map.mapIterator();
-
         assertThrows(IllegalStateException.class, () -> it.getKey());
         assertThrows(IllegalStateException.class, () -> it.getValue());
         if (isAddSupported()) {
             assertThrows(IllegalStateException.class, () -> it.setValue((V) 
"V"));
         }
-
         if (!isHashSetValue() && isAddSupported()) {
-            assertTrue(it.hasNext() );
-            assertEquals("k0", it.next());
-            assertEquals("k0", it.getKey());
-            assertEquals("v0_0", it.getValue());
-            assertEquals("k0", it.next());
-            assertEquals("k0", it.getKey());
-            assertEquals("v0_1", it.getValue());
-            assertEquals("k1", it.next());
-            assertEquals("k1", it.getKey());
-            assertEquals("v1_0", it.getValue());
-            assertEquals("k1", it.next());
-            assertEquals("k1", it.getKey());
-            assertEquals("v1_1", it.getValue());
-            assertEquals("k2", it.next());
-            assertEquals("k2", it.getKey());
-            assertEquals("v2_0", it.getValue());
-            assertEquals("k2", it.next());
-            assertEquals("k2", it.getKey());
-            assertEquals("v2_1", it.getValue());
+            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"));
+                }
+            }
             assertThrows(UnsupportedOperationException.class, () -> 
it.setValue((V) "threetrois"));
         }
     }

Reply via email to