From 31b411685817d85dd96c931874e0aad358f1d773 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 31 Mar 2024 10:31:52 -0400 Subject: [PATCH] Rework test fixtures Next, grow the amount of data tested to find bugs in the tests with non-repeatable map ordering --- .../multimap/AbstractMultiValuedMapTest.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 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 1daf23195..f305cbe21 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -1257,10 +1257,18 @@ public abstract class AbstractMultiValuedMapTest extends AbstractObjectTes assumeTrue(isRemoveSupported()); final MultiValuedMap map = makeFullMap(); final Collection values = map.values(); - values.remove("v0_0"); - values.remove("v0_1"); - assertFalse(map.containsKey("k0")); - assertEquals(4, map.size()); + final int maxK = getSampleKeySize(); + final int maxV = getSampleCountPerKey(); + int expectedSize = map.size(); + for (int k = 0; k < maxK; k++) { + for (int v = 0; v < maxV; v++) { + values.remove(makeValue(k, v)); + } + assertFalse(map.containsKey(makeKey(k))); + expectedSize -= maxV; + assertEquals(expectedSize, map.size()); + } + assertEquals(0, map.size()); } @Test