diff --git a/src/test/java/org/apache/commons/collections4/BulkTest.java b/src/test/java/org/apache/commons/collections4/BulkTest.java index 174622748..e21c5e920 100644 --- a/src/test/java/org/apache/commons/collections4/BulkTest.java +++ b/src/test/java/org/apache/commons/collections4/BulkTest.java @@ -137,6 +137,17 @@ import junit.framework.TestSuite; */ public class BulkTest extends TestCase implements Cloneable { + /** + * IBM JDK 1.6.0 has several bugs in their java.util.TreeMap implementation. + */ + protected static final boolean IBMJDK16; + static { + final String vmName = System.getProperty("java.vm.name"); + final String version = System.getProperty("java.version"); + + IBMJDK16 = vmName != null && vmName.equals("IBM J9 VM") && + version != null && version.equals("1.6.0"); + } // Note: BulkTest is Cloneable to make it easier to construct // BulkTest instances for simple test methods that are defined in diff --git a/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java b/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java index 29f84ef27..185955996 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java @@ -155,27 +155,21 @@ public class DualTreeBidiMap2Test, V extends Comparable< public String[] ignoredTests() { String recursiveTest = "DualTreeBidiMap2Test.bulkTestInverseMap.bulkTestInverseMap"; - // there are several bugs in the following JVM: - // IBM J9 VM build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr12-20121024_126067 - // thus disabling tests related to these bugs - - final String vmName = System.getProperty("java.vm.name"); - final String version = System.getProperty("java.version"); - - if (vmName == null || version == null) { - return new String[] { recursiveTest }; - } - - if (vmName.equals("IBM J9 VM") && version.equals("1.6.0")) { - final String preSub = "DualTreeBidiMap2Test.bulkTestSubMap.bulkTestMap"; - final String preTail = "DualTreeBidiMap2Test.bulkTestTailMap.bulkTestMap"; + if (IBMJDK16) { + final String preSub = "DualTreeBidiMap2Test.bulkTestSubMap."; + final String preTail = "DualTreeBidiMap2Test.bulkTestTailMap."; return new String[] { recursiveTest, - preSub + "EntrySet.testCollectionIteratorRemove", - preSub + "Values.testCollectionIteratorRemove", - preTail + "Values.testCollectionClear", - preTail + "Values.testCollectionRemoveAll", - preTail + "Values.testCollectionRetainAll" + preSub + "bulkTestMapEntrySet.testCollectionIteratorRemove", + preSub + "bulkTestMapValues.testCollectionIteratorRemove", + preTail + "testMapRemove", + preTail + "bulkTestMapEntrySet.testCollectionIteratorRemove", + preTail + "bulkTestMapEntrySet.testCollectionRemoveAll", + preTail + "bulkTestMapKeySet.testCollectionIteratorRemove", + preTail + "bulkTestMapKeySet.testCollectionRemoveAll", + preTail + "bulkTestMapValues.testCollectionClear", + preTail + "bulkTestMapValues.testCollectionRemoveAll", + preTail + "bulkTestMapValues.testCollectionRetainAll" }; } else { return new String[] { recursiveTest }; diff --git a/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMapTest.java b/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMapTest.java index 235e76ba0..510162850 100644 --- a/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMapTest.java +++ b/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMapTest.java @@ -48,29 +48,23 @@ public class DualTreeBidiMapTest, V extends Comparable extends AbstractSortedMapTest @Override public String[] ignoredTests() { - // there are several bugs in the following JVM: - // IBM J9 VM build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr12-20121024_126067 - // thus disabling tests related to these bugs - - final String vmName = System.getProperty("java.vm.name"); - final String version = System.getProperty("java.version"); - - if (vmName == null || version == null) { - return null; - } - - if (vmName.equals("IBM J9 VM") && version.equals("1.6.0")) { - final String preSubMap = "TransformedSortedMapTest.bulkTestSubMap.bulkTestMap"; - final String preTailMap = "TransformedSortedMapTest.bulkTestTailMap.bulkTestMap"; + if (IBMJDK16) { + final String preSubMap = "TransformedSortedMapTest.bulkTestSubMap."; + final String preTailMap = "TransformedSortedMapTest.bulkTestTailMap."; return new String[] { - preSubMap + "EntrySet.testCollectionIteratorRemove", - preSubMap + "KeySet.testCollectionRemove", - preSubMap + "Values.testCollectionIteratorRemove", - preTailMap + "Values.testCollectionClear", - preTailMap + "Values.testCollectionRemoveAll", - preTailMap + "Values.testCollectionRetainAll" + preSubMap + "bulkTestMapEntrySet.testCollectionIteratorRemove", + preSubMap + "bulkTestMapKeySet.testCollectionRemove", + preSubMap + "bulkTestMapValues.testCollectionIteratorRemove", + preTailMap + "testMapRemove", + preTailMap + "bulkTestMapEntrySet.testCollectionIteratorRemove", + preTailMap + "bulkTestMapEntrySet.testCollectionRemoveAll", + preTailMap + "bulkTestMapKeySet.testCollectionIteratorRemove", + preTailMap + "bulkTestMapKeySet.testCollectionRemoveAll", + preTailMap + "bulkTestMapValues.testCollectionClear", + preTailMap + "bulkTestMapValues.testCollectionRemoveAll", + preTailMap + "bulkTestMapValues.testCollectionRetainAll" }; } else { return null; diff --git a/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java b/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java index e4eb48be0..3cc00dfe5 100644 --- a/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java +++ b/src/test/java/org/apache/commons/collections4/trie/UnmodifiableTrieTest.java @@ -88,6 +88,23 @@ public class UnmodifiableTrieTest extends AbstractSortedMapTest { //----------------------------------------------------------------------- + /** + * Override to prevent infinite recursion of tests. + */ + @Override + public String[] ignoredTests() { + if (IBMJDK16) { + final String prefix = "UnmodifiableTrieTest."; + return new String[] { + prefix + "bulkTestHeadMap.bulkTestMapEntrySet.testCollectionToArray2", + prefix + "bulkTestTailMap.bulkTestMapEntrySet.testCollectionToArray2", + prefix + "bulkTestSubMap.bulkTestMapEntrySet.testCollectionToArray2" + }; + } else { + return null; + } + } + @Override public String getCompatibilityVersion() { return "4";