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:
parent
cff3638a87
commit
8cae451853
|
@ -1030,33 +1030,26 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
||||||
public void testMultiValuedMapIterator() {
|
public void testMultiValuedMapIterator() {
|
||||||
final MultiValuedMap<K, V> map = makeFullMap();
|
final MultiValuedMap<K, V> map = makeFullMap();
|
||||||
final MapIterator<K, V> it = map.mapIterator();
|
final MapIterator<K, V> it = map.mapIterator();
|
||||||
|
|
||||||
assertThrows(IllegalStateException.class, () -> it.getKey());
|
assertThrows(IllegalStateException.class, () -> it.getKey());
|
||||||
assertThrows(IllegalStateException.class, () -> it.getValue());
|
assertThrows(IllegalStateException.class, () -> it.getValue());
|
||||||
if (isAddSupported()) {
|
if (isAddSupported()) {
|
||||||
assertThrows(IllegalStateException.class, () -> it.setValue((V) "V"));
|
assertThrows(IllegalStateException.class, () -> it.setValue((V) "V"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isHashSetValue() && isAddSupported()) {
|
if (!isHashSetValue() && isAddSupported()) {
|
||||||
assertTrue(it.hasNext());
|
assertTrue(it.hasNext());
|
||||||
assertEquals("k0", it.next());
|
final int maxK = getSampleKeySize();
|
||||||
assertEquals("k0", it.getKey());
|
final int maxV = getSampleCountPerKey();
|
||||||
assertEquals("v0_0", it.getValue());
|
for (int k = 0; k < maxK; k++) {
|
||||||
assertEquals("k0", it.next());
|
final Object key = makeKey(k);
|
||||||
assertEquals("k0", it.getKey());
|
for (int v = 0; v < maxV; v++) {
|
||||||
assertEquals("v0_1", it.getValue());
|
final Object value = makeValue(k, v);
|
||||||
assertEquals("k1", it.next());
|
assertTrue(it.hasNext());
|
||||||
assertEquals("k1", it.getKey());
|
assertEquals(key, it.next());
|
||||||
assertEquals("v1_0", it.getValue());
|
assertEquals(key, it.getKey());
|
||||||
assertEquals("k1", it.next());
|
assertEquals(value, it.getValue());
|
||||||
assertEquals("k1", it.getKey());
|
assertThrows(UnsupportedOperationException.class, () -> it.setValue((V) "threetrois"));
|
||||||
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());
|
|
||||||
assertThrows(UnsupportedOperationException.class, () -> it.setValue((V) "threetrois"));
|
assertThrows(UnsupportedOperationException.class, () -> it.setValue((V) "threetrois"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue