scolebourne 2004/01/24 13:48:27
Modified: collections/src/test/org/apache/commons/collections/map
AbstractTestMap.java
Log:
Avoid some null-based tests in JDK1.2
Revision Changes Path
1.7 +14 -4
jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java
Index: AbstractTestMap.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractTestMap.java 14 Jan 2004 21:34:34 -0000 1.6
+++ AbstractTestMap.java 24 Jan 2004 21:48:27 -0000 1.7
@@ -159,6 +159,16 @@
*/
public abstract class AbstractTestMap extends AbstractTestObject {
+ /**
+ * JDK1.2 has bugs in null handling of Maps, especially HashMap.Entry.toString
+ * This avoids nulls for JDK1.2
+ */
+ private static final boolean JDK12;
+ static {
+ String str = System.getProperty("java.version");
+ JDK12 = str.startsWith("1.2");
+ }
+
// These instance variables are initialized with the reset method.
// Tests for map methods that alter the map (put, putAll, remove)
// first call reset() to create the map and its views; then perform
@@ -304,7 +314,7 @@
"hello", "goodbye", "we'll", "see", "you", "all", "again",
"key",
"key2",
- (isAllowNullKey()) ? null : "nonnullkey"
+ (isAllowNullKey() && !JDK12) ? null : "nonnullkey"
};
return result;
}
@@ -346,7 +356,7 @@
Object[] result = new Object[] {
"blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",
"hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",
- (isAllowNullValue()) ? null : "nonnullvalue",
+ (isAllowNullValue() && !JDK12) ? null : "nonnullvalue",
"value",
(isAllowDuplicateValues()) ? "value" : "value2",
};
@@ -366,7 +376,7 @@
*/
public Object[] getNewSampleValues() {
Object[] result = new Object[] {
- (isAllowNullValue() && isAllowDuplicateValues()) ? null :
"newnonnullvalue",
+ (isAllowNullValue() && !JDK12 && isAllowDuplicateValues()) ? null :
"newnonnullvalue",
"newvalue",
(isAllowDuplicateValues()) ? "newvalue" : "newvalue2",
"newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv",
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]