[COLLECTIONS-661] Intermittent test failures in Windows for HashSetValuedHashMap.
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/eed8a7ad Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/eed8a7ad Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/eed8a7ad Branch: refs/heads/master Commit: eed8a7adb3de7441751e846f4a75d110dd205f23 Parents: b5eb4fc Author: Bruno P. Kinoshita <brunodepau...@yahoo.com.br.invalid> Authored: Wed Oct 11 16:37:09 2017 -0600 Committer: Gary Gregory <ggreg...@apache.org> Committed: Wed Oct 11 16:37:09 2017 -0600 ---------------------------------------------------------------------- src/changes/changes.xml | 3 +++ .../collections4/multimap/AbstractMultiValuedMapTest.java | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-collections/blob/eed8a7ad/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index cbe01ce..118df35 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -21,6 +21,9 @@ </properties> <body> <release version="4.2" date="YYYY-MM-DD" description="New features"> + <action issue="COLLECTIONS-661" dev="kinow" type="fix"> + Intermittent test failures in Windows for HashSetValuedHashMap + </action> <action issue="COLLECTIONS-660" dev="kinow" type="fix"> Uncomment test in AbstractMapTest regarding LRUMap equals </action> http://git-wip-us.apache.org/repos/asf/commons-collections/blob/eed8a7ad/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java ---------------------------------------------------------------------- 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 1faaaa7..b578459 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java @@ -1086,7 +1086,10 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes @Override @SuppressWarnings("unchecked") public Collection<V>[] getSampleValues() { - boolean isSetValuedMap = AbstractMultiValuedMapTest.this.getMap() instanceof SetValuedMap; + // Calling getMap() instead of makeObject() would make more sense, but due to concurrency + // issues, this may lead to intermittent issues. See COLLECTIONS-661. A better solution + // would be to re-design the tests, or add a boolean method to the parent. + boolean isSetValuedMap = AbstractMultiValuedMapTest.this.makeObject() instanceof SetValuedMap; V[] sampleValues = AbstractMultiValuedMapTest.this.getSampleValues(); Collection<V>[] colArr = new Collection[3]; for(int i = 0; i < 3; i++) { @@ -1099,7 +1102,9 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes @Override @SuppressWarnings("unchecked") public Collection<V>[] getNewSampleValues() { - boolean isSetValuedMap = AbstractMultiValuedMapTest.this.getMap() instanceof SetValuedMap; + // See comment in getSampleValues() to understand why we are calling makeObject() and not + // getMap(). See COLLECTIONS-661 for more. + boolean isSetValuedMap = AbstractMultiValuedMapTest.this.makeObject() instanceof SetValuedMap; Object[] sampleValues = { "ein", "ek", "zwei", "duey", "drei", "teen" }; Collection<V>[] colArr = new Collection[3]; for (int i = 0; i < 3; i++) {