[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: (commons-collections) 03/05: Rework test fixtures
From: ggregory () apache ! org
Date: 2024-03-31 15:11:11
Message-ID: 20240331151108.CE01F440820 () gitbox2-he-fi ! apache ! org
[Download RAW message or body]
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 42ae7b98c2f6d39af844b7bd48d0a71bde3d308f
Author: Gary Gregory <garydgregory@gmail.com>
AuthorDate: Sun Mar 31 11:06:49 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 | 25 +++++++++++-----------
1 file changed, 12 insertions(+), 13 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 4a24146a5..15f490d70 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
@@ -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")); }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic