Rework test fixtures

Next, grow the amount of data tested to find bugs in the tests with
non-repeatable map ordering
This commit is contained in:
Gary Gregory 2024-03-31 11:06:49 -04:00
parent 6d3740fb48
commit 42ae7b98c2
1 changed files with 12 additions and 13 deletions

View File

@ -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"));
}
}