Skip to content

Commit

Permalink
Rework test fixtures
Browse files Browse the repository at this point in the history
Next, grow the amount of data tested to find bugs in the tests with
non-repeatable map ordering
  • Loading branch information
garydgregory committed Mar 31, 2024
1 parent 6d3740f commit 42ae7b9
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public K[] getSampleKeys() {
}

public int getSampleKeySize() {
return 3;
return 256;
}

public int getSampleTotalValueCount() {
Expand Down Expand Up @@ -1037,19 +1037,18 @@ public void testMultiValuedMapIterator() {
}
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"));
}
}
Expand Down

0 comments on commit 42ae7b9

Please sign in to comment.