You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/10/08 00:20:58 UTC
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/decorators TestFixedSizeSortedMap.java TestLazySortedMap.java TestPredicatedSortedMap.java TestUnmodifiableMap.java TestFixedSizeMap.java
scolebourne 2003/10/07 15:20:58
Modified: collections/src/test/org/apache/commons/collections
TestBidiMap.java AbstractTestSortedMap.java
AbstractTestMap.java TestMapUtils.java
TestReferenceMap.java TestDoubleOrderedMap.java
TestFastHashMap.java TestBeanMap.java
TestTreeMap.java TestFastTreeMap.java
collections/src/test/org/apache/commons/collections/decorators
TestFixedSizeSortedMap.java TestLazySortedMap.java
TestPredicatedSortedMap.java
TestUnmodifiableMap.java TestFixedSizeMap.java
Log:
Enhance Map tests pre-release of testframework
Revision Changes Path
1.6 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/TestBidiMap.java
Index: TestBidiMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestBidiMap.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestBidiMap.java 6 Oct 2003 23:47:17 -0000 1.5
+++ TestBidiMap.java 7 Oct 2003 22:20:57 -0000 1.6
@@ -128,7 +128,7 @@
/**
* Override to indicate to AbstractTestMap this is a BidiMap.
*/
- protected boolean useDuplicateValues() {
+ protected boolean isAllowDuplicateValues() {
return false;
}
1.3 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestSortedMap.java
Index: AbstractTestSortedMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestSortedMap.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractTestSortedMap.java 6 Oct 2003 23:44:56 -0000 1.2
+++ AbstractTestSortedMap.java 7 Oct 2003 22:20:57 -0000 1.3
@@ -84,7 +84,7 @@
*
* @return false
*/
- protected boolean useNullKey() {
+ protected boolean isAllowNullKey() {
return false;
}
1.4 +198 -128 jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestMap.java
Index: AbstractTestMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/AbstractTestMap.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractTestMap.java 5 Oct 2003 20:47:37 -0000 1.3
+++ AbstractTestMap.java 7 Oct 2003 22:20:57 -0000 1.4
@@ -79,32 +79,33 @@
* override one or more of the other protected methods. They're described
* below.
* <p>
- * <B>Entry Population Methods</B><P>
- *
+ * <b>Entry Population Methods</b>
+ * <p>
* Override these methods if your map requires special entries:
+ *
+ * <ul>
+ * <li>{@link #getSampleKeys()}
+ * <li>{@link #getSampleValues()}
+ * <li>{@link #getNewSampleValues()}
+ * <li>{@link #getOtherKeys()}
+ * <li>{@link #getOtherValues()}
+ * </ul>
*
- * <UL>
- * <LI>{@link #getSampleKeys()}
- * <LI>{@link #getSampleValues()}
- * <LI>{@link #getNewSampleValues()}
- * <LI>{@link #getOtherKeys()}
- * <LI>{@link #getOtherValues()}
- * </UL>
- *
- * <B>Supported Operation Methods</B><P>
- *
+ * <b>Supported Operation Methods</b>
+ * <p>
* Override these methods if your map doesn't support certain operations:
*
- * <UL>
- * <LI> {@link #useDuplicateValues()}
- * <LI> {@link #useNullKey()}
- * <LI> {@link #useNullValue()}
- * <LI> {@link #isAddRemoveModifiable()}
- * <LI> {@link #isChangeable()}
- * </UL>
- *
- * <B>Fixture Methods</B><P>
+ * <ul>
+ * <li> {@link #isPutAddSupported()}
+ * <li> {@link #isPutChangeSupported()}
+ * <li> {@link #isRemoveSupported()}
+ * <li> {@link #isAllowDuplicateValues()}
+ * <li> {@link #isAllowNullKey()}
+ * <li> {@link #isAllowNullValue()}
+ * </ul>
*
+ * <b>Fixture Methods</b>
+ * <p>
* For tests on modification operations (puts and removes), fixtures are used
* to verify that that operation results in correct state for the map and its
* collection views. Basically, the modification is performed against your
@@ -139,13 +140,13 @@
* {@link #verifyValues()} method to verify that the values are unique and in
* ascending order.<P>
*
- * <B>Other Notes</B><P>
- *
+ * <b>Other Notes</b>
+ * <p>
* If your {@link Map} fails one of these tests by design, you may still use
- * this base set of cases. Simply override the test case (method) your {@link
- * Map} fails and/or the methods that define the assumptions used by the test
+ * this base set of cases. Simply override the test case (method) your map
+ * fails and/or the methods that define the assumptions used by the test
* cases. For example, if your map does not allow duplicate values, override
- * {@link #useDuplicateValues()} and have it return <code>false</code>
+ * {@link #isAllowDuplicateValues()} and have it return <code>false</code>
*
* @author Michael Smith
* @author Rodney Waldhoff
@@ -179,7 +180,6 @@
/** HashMap created by reset(). */
protected Map confirmed;
-
/**
* JUnit constructor.
*
@@ -189,44 +189,77 @@
super(testName);
}
+ /**
+ * Returns true if the maps produced by
+ * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+ * support the <code>put</code> and <code>putAll</code> operations
+ * adding new mappings.
+ * <p>
+ * Default implementation returns true.
+ * Override if your collection class does not support put adding.
+ */
+ protected boolean isPutAddSupported() {
+ return true;
+ }
/**
- * Override if your map does not allow a <code>null</code> key. The
- * default implementation returns <code>true</code>
+ * Returns true if the maps produced by
+ * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+ * support the <code>put</code> and <code>putAll</code> operations
+ * changing existing mappings.
+ * <p>
+ * Default implementation returns true.
+ * Override if your collection class does not support put changing.
*/
- protected boolean useNullKey() {
+ protected boolean isPutChangeSupported() {
return true;
}
/**
- * Override if your map does not allow <code>null</code> values. The
- * default implementation returns <code>true</code>.
+ * Returns true if the maps produced by
+ * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+ * support the <code>remove</code> and <code>clear</code> operations.
+ * <p>
+ * Default implementation returns true.
+ * Override if your collection class does not support removal operations.
*/
- protected boolean useNullValue() {
+ protected boolean isRemoveSupported() {
return true;
}
/**
- * Override if your map does not allow duplicate values. The default
- * implementation returns <code>true</code>.
+ * Returns true if the maps produced by
+ * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+ * supports null keys.
+ * <p>
+ * Default implementation returns true.
+ * Override if your collection class does not support null keys.
*/
- protected boolean useDuplicateValues() {
+ protected boolean isAllowNullKey() {
return true;
}
/**
- * Override if your map allows its mappings to be changed to new values.
- * The default implementation returns <code>true</code>.
+ * Returns true if the maps produced by
+ * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+ * supports null values.
+ * <p>
+ * Default implementation returns true.
+ * Override if your collection class does not support null values.
*/
- protected boolean isChangeable() {
+ protected boolean isAllowNullValue() {
return true;
}
/**
- * Override if your map does not allow add/remove modifications. The
- * default implementation returns <code>true</code>.
+ * Returns true if the maps produced by
+ * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+ * supports duplicate values.
+ * <p>
+ * Default implementation returns true.
+ * Override if your collection class does not support duplicate values.
*/
- protected boolean isAddRemoveModifiable() {
+ protected boolean isAllowDuplicateValues() {
return true;
}
@@ -235,7 +268,7 @@
* method must return an array with the same length as {@link
* #getSampleValues()} and all array elements must be different. The
* default implementation constructs a set of String keys, and includes a
- * single null key if {@link #useNullKey()} returns <code>true</code>.
+ * single null key if {@link #isAllowNullKey()} returns <code>true</code>.
*/
protected Object[] getSampleKeys() {
Object[] result = new Object[] {
@@ -243,7 +276,7 @@
"hello", "goodbye", "we'll", "see", "you", "all", "again",
"key",
"key2",
- (useNullKey()) ? null : "nonnullkey"
+ (isAllowNullKey()) ? null : "nonnullkey"
};
return result;
}
@@ -258,10 +291,10 @@
}
/**
- * Returns a list of string elements suitable for return by
- * {@link getOtherElements()}. Override getOtherElements to return
- * the results of this method if your collection does not support
- * heterogenous elements or the null element.
+ * Returns a list of string elements suitable for return by
+ * {@link getOtherElements()}. Override getOtherElements to return
+ * the results of this method if your collection does not support
+ * heterogenous elements or the null element.
*/
protected Object[] getOtherNonNullStringElements() {
return new Object[] {
@@ -271,41 +304,41 @@
}
/**
- * Returns the set of values in the mappings used to test the map. This
- * method must return an array with the same length as {@link
- * #getSampleKeys()}. The default implementation constructs a set of
- * String values and includes a single null value if {@link
- * #useNullValue()} returns <code>true</code>, and includes two values
- * that are the same if {@link #useDuplicateValues()} returns
- * <code>true</code>.
+ * Returns the set of values in the mappings used to test the map. This
+ * method must return an array with the same length as
+ * {@link #getSampleKeys()}. The default implementation constructs a set of
+ * String values and includes a single null value if
+ * {@link #isNullValueSupported()} returns <code>true</code>, and includes
+ * two values that are the same if {@link #isAllowDuplicateValues()} returns
+ * <code>true</code>.
*/
protected Object[] getSampleValues() {
Object[] result = new Object[] {
"blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",
"hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",
- (useNullValue()) ? null : "nonnullvalue",
+ (isAllowNullValue()) ? null : "nonnullvalue",
"value",
- (useDuplicateValues()) ? "value" : "value2",
+ (isAllowDuplicateValues()) ? "value" : "value2",
};
return result;
}
/**
- * Returns a the set of values that can be used to replace the values
- * returned from {@link #getSampleValues()}. This method must return an
- * array with the same length as {@link #getSampleValues()}. The values
- * returned from this method should not be the same as those returned from
- * {@link #getSampleValues()}. The default implementation constructs a
- * set of String values and includes a single null value if {@link
- * #useNullValue()} returns <code>true</code>, and includes two values
- * that are the same if {@link #useDuplicateValues()} returns
- * <code>true</code>.
+ * Returns a the set of values that can be used to replace the values
+ * returned from {@link #getSampleValues()}. This method must return an
+ * array with the same length as {@link #getSampleValues()}. The values
+ * returned from this method should not be the same as those returned from
+ * {@link #getSampleValues()}. The default implementation constructs a
+ * set of String values and includes a single null value if
+ * {@link #isNullValueSupported()} returns <code>true</code>, and includes two values
+ * that are the same if {@link #isAllowDuplicateValues()} returns
+ * <code>true</code>.
*/
protected Object[] getNewSampleValues() {
Object[] result = new Object[] {
- (useNullValue() && useDuplicateValues()) ? null : "newnonnullvalue",
+ (isAllowNullValue() && isAllowDuplicateValues()) ? null : "newnonnullvalue",
"newvalue",
- (useDuplicateValues()) ? "newvalue" : "newvalue2",
+ (isAllowDuplicateValues()) ? "newvalue" : "newvalue2",
"newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv",
"newgollyv", "newgeev", "newhellov", "newgoodbyev", "newwe'llv",
"newseev", "newyouv", "newallv", "newagainv",
@@ -331,12 +364,12 @@
keys[i] == null || values[i] == null);
assertTrue("NullPointerException on null key, but " +
- "useNullKey is not overridden to return false.",
- keys[i] == null || !useNullKey());
+ "isNullKeySupported is not overridden to return false.",
+ keys[i] == null || !isAllowNullKey());
assertTrue("NullPointerException on null value, but " +
- "useNullValue is not overridden to return false.",
- values[i] == null || !useNullValue());
+ "isNullValueSupported is not overridden to return false.",
+ values[i] == null || !isAllowNullValue());
assertTrue("Unknown reason for NullPointer.", false);
}
@@ -379,14 +412,14 @@
//-----------------------------------------------------------------------
/**
- * Test to ensure the test setup is working properly. This method checks
- * to ensure that the getSampleKeys and getSampleValues methods are
- * returning results that look appropriate. That is, they both return a
- * non-null array of equal length. The keys array must not have any
- * duplicate values, and may only contain a (single) null key if
- * useNullKey() returns true. The values array must only have a null
- * value if useNullValue() is true and may only have duplicate values if
- * useDuplicateValues() returns true.
+ * Test to ensure the test setup is working properly. This method checks
+ * to ensure that the getSampleKeys and getSampleValues methods are
+ * returning results that look appropriate. That is, they both return a
+ * non-null array of equal length. The keys array must not have any
+ * duplicate values, and may only contain a (single) null key if
+ * isNullKeySupported() returns true. The values array must only have a null
+ * value if useNullValue() is true and may only have duplicate values if
+ * isAllowDuplicateValues() returns true.
*/
public void testSampleMappings() {
Object[] keys = getSampleKeys();
@@ -417,12 +450,12 @@
(!keys[i].equals(keys[j]) &&
!keys[j].equals(keys[i]))));
}
- assertTrue("failure in test: found null key, but useNullKey " +
- "is false.", keys[i] != null || useNullKey());
- assertTrue("failure in test: found null value, but useNullValue " +
- "is false.", values[i] != null || useNullValue());
- assertTrue("failure in test: found null new value, but useNullValue " +
- "is false.", newValues[i] != null || useNullValue());
+ assertTrue("failure in test: found null key, but isNullKeySupported " +
+ "is false.", keys[i] != null || isAllowNullKey());
+ assertTrue("failure in test: found null value, but isNullValueSupported " +
+ "is false.", values[i] != null || isAllowNullValue());
+ assertTrue("failure in test: found null new value, but isNullValueSupported " +
+ "is false.", newValues[i] != null || isAllowNullValue());
assertTrue("failure in test: values should not be the same as new value",
values[i] != newValues[i] &&
(values[i] == null || !values[i].equals(newValues[i])));
@@ -493,7 +526,7 @@
}
/**
- * Tests {@link Map#clear()}. If the map {@link #isAddRemoveModifiable()
+ * Tests {@link Map#clear()}. If the map {@link #isRemoveSupported()}
* can add and remove elements}, then {@link Map#size()} and {@link
* Map#isEmpty()} are used to ensure that map has no elements after a call
* to clear. If the map does not support adding and removing elements,
@@ -501,7 +534,14 @@
* UnsupportedOperationException.
*/
public void testMapClear() {
- if (!isAddRemoveModifiable()) return;
+ if (!isRemoveSupported()) {
+ try {
+ resetFull();
+ map.clear();
+ fail("Expected UnsupportedOperationException on clear");
+ } catch (UnsupportedOperationException ex) {}
+ return;
+ }
resetEmpty();
map.clear();
@@ -693,41 +733,64 @@
* Tests Map.put(Object, Object)
*/
public void testMapPut() {
- if (!isAddRemoveModifiable()) return;
-
resetEmpty();
-
Object[] keys = getSampleKeys();
Object[] values = getSampleValues();
Object[] newValues = getNewSampleValues();
- for(int i = 0; i < keys.length; i++) {
- Object o = map.put(keys[i], values[i]);
- confirmed.put(keys[i], values[i]);
- verify();
- assertTrue("First map.put should return null", o == null);
- assertTrue("Map should contain key after put",
- map.containsKey(keys[i]));
- assertTrue("Map should contain value after put",
- map.containsValue(values[i]));
- }
-
- for(int i = 0; i < keys.length; i++) {
- Object o = map.put(keys[i], newValues[i]);
- confirmed.put(keys[i], newValues[i]);
- verify();
- assertEquals("Second map.put should return previous value",
- values[i], o);
- assertTrue("Map should still contain key after put",
- map.containsKey(keys[i]));
- assertTrue("Map should contain new value after put",
- map.containsValue(newValues[i]));
-
- // if duplicates are allowed, we're not guaranteed that the value
- // no longer exists, so don't try checking that.
- if(!useDuplicateValues()) {
- assertTrue("Map should not contain old value after second put",
- !map.containsValue(values[i]));
+ if (isPutAddSupported()) {
+ for (int i = 0; i < keys.length; i++) {
+ Object o = map.put(keys[i], values[i]);
+ confirmed.put(keys[i], values[i]);
+ verify();
+ assertTrue("First map.put should return null", o == null);
+ assertTrue("Map should contain key after put",
+ map.containsKey(keys[i]));
+ assertTrue("Map should contain value after put",
+ map.containsValue(values[i]));
+ }
+ if (isPutChangeSupported()) {
+ for (int i = 0; i < keys.length; i++) {
+ Object o = map.put(keys[i], newValues[i]);
+ confirmed.put(keys[i], newValues[i]);
+ verify();
+ assertEquals("Map.put should return previous value when changed",
+ values[i], o);
+ assertTrue("Map should still contain key after put when changed",
+ map.containsKey(keys[i]));
+ assertTrue("Map should contain new value after put when changed",
+ map.containsValue(newValues[i]));
+
+ // if duplicates are allowed, we're not guaranteed that the value
+ // no longer exists, so don't try checking that.
+ if (!isAllowDuplicateValues()) {
+ assertTrue("Map should not contain old value after put when changed",
+ !map.containsValue(values[i]));
+ }
+ }
+ }
+
+ } else if (isPutChangeSupported()) {
+ resetFull();
+ int i = 0;
+ for (Iterator it = map.keySet().iterator(); it.hasNext() && i < newValues.length; i++) {
+ Object key = (Object) it.next();
+ Object o = map.put(key, newValues[i]);
+ Object value = confirmed.put(key, newValues[i]);
+ verify();
+ assertEquals("Map.put should return previous value when changed",
+ value, o);
+ assertTrue("Map should still contain key after put when changed",
+ map.containsKey(key));
+ assertTrue("Map should contain new value after put when changed",
+ map.containsValue(newValues[i]));
+
+ // if duplicates are allowed, we're not guaranteed that the value
+ // no longer exists, so don't try checking that.
+ if (!isAllowDuplicateValues()) {
+ assertTrue("Map should not contain old value after put when changed",
+ !map.containsValue(values[i]));
+ }
}
}
}
@@ -736,7 +799,7 @@
* Tests Map.putAll(Collection)
*/
public void testMapPutAll() {
- if (!isAddRemoveModifiable()) return;
+ if (!isPutAddSupported()) return;
resetEmpty();
@@ -764,7 +827,14 @@
* Tests Map.remove(Object)
*/
public void testMapRemove() {
- if (!isAddRemoveModifiable()) return;
+ if (!isRemoveSupported()) {
+ try {
+ resetFull();
+ map.remove(map.keySet().iterator().next());
+ fail("Expected UnsupportedOperationException on remove");
+ } catch (UnsupportedOperationException ex) {}
+ return;
+ }
resetEmpty();
@@ -807,7 +877,7 @@
* the underlying map for clear().
*/
public void testValuesClearChangesMap() {
- if (!isAddRemoveModifiable()) return;
+ if (!isRemoveSupported()) return;
// clear values, reflected in map
resetFull();
@@ -833,7 +903,7 @@
* the underlying map for clear().
*/
public void testKeySetClearChangesMap() {
- if (!isAddRemoveModifiable()) return;
+ if (!isRemoveSupported()) return;
// clear values, reflected in map
resetFull();
@@ -859,7 +929,7 @@
* the underlying map for clear().
*/
public void testEntrySetClearChangesMap() {
- if (!isAddRemoveModifiable()) return;
+ if (!isRemoveSupported()) return;
// clear values, reflected in map
resetFull();
@@ -1007,7 +1077,7 @@
protected boolean isRemoveSupported() {
// Entry set should only support remove if map does
- return isAddRemoveModifiable();
+ return AbstractTestMap.this.isRemoveSupported();
}
protected void resetFull() {
@@ -1066,7 +1136,7 @@
}
protected boolean isRemoveSupported() {
- return isAddRemoveModifiable();
+ return AbstractTestMap.this.isRemoveSupported();
}
protected void resetEmpty() {
@@ -1127,7 +1197,7 @@
}
protected boolean isRemoveSupported() {
- return isAddRemoveModifiable();
+ return AbstractTestMap.this.isRemoveSupported();
}
protected boolean areEqualElementsDistinguishable() {
1.18 +4 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestMapUtils.java
Index: TestMapUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMapUtils.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- TestMapUtils.java 5 Oct 2003 21:17:40 -0000 1.17
+++ TestMapUtils.java 7 Oct 2003 22:20:57 -0000 1.18
@@ -163,11 +163,11 @@
public BulkTest bulkTestTypedMap() {
return new AbstractTestMap("") {
- public boolean useNullKey() {
+ public boolean isAllowNullKey() {
return false;
}
- public boolean useNullValue() {
+ public boolean isAllowNullValue() {
return false;
}
1.13 +4 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestReferenceMap.java
Index: TestReferenceMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestReferenceMap.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestReferenceMap.java 5 Oct 2003 21:23:21 -0000 1.12
+++ TestReferenceMap.java 7 Oct 2003 22:20:57 -0000 1.13
@@ -89,11 +89,11 @@
return map;
}
- public boolean useNullKey() {
+ public boolean isAllowNullKey() {
return false;
}
- public boolean useNullValue() {
+ public boolean isAllowNullValue() {
return false;
}
1.10 +5 -5 jakarta-commons/collections/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java
Index: TestDoubleOrderedMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestDoubleOrderedMap.java 5 Oct 2003 21:11:06 -0000 1.9
+++ TestDoubleOrderedMap.java 7 Oct 2003 22:20:57 -0000 1.10
@@ -104,7 +104,7 @@
/**
* The default comparator in double ordered map does not allow null keys.
**/
- public boolean useNullKey() {
+ public boolean isAllowNullKey() {
return false;
}
@@ -112,14 +112,14 @@
* The default comparator in double ordered map does not allow null keys,
* and values are keys in this map.
**/
- public boolean useNullValue() {
+ public boolean isAllowNullValue() {
return false;
}
/**
* Double ordered map does not support duplicate values
**/
- public boolean useDuplicateValues() {
+ public boolean isAllowDuplicateValues() {
return false;
}
1.12 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastHashMap.java
Index: TestFastHashMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastHashMap.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TestFastHashMap.java 5 Oct 2003 21:11:06 -0000 1.11
+++ TestFastHashMap.java 7 Oct 2003 22:20:57 -0000 1.12
@@ -93,7 +93,7 @@
* There is a bug in JDK1.2 HashMap; the keySet() will incorrectly
* return false when a null value is removed.
*/
- public boolean useNullValue() {
+ public boolean isAllowNullValue() {
return false;
}
}
1.13 +33 -16 jakarta-commons/collections/src/test/org/apache/commons/collections/TestBeanMap.java
Index: TestBeanMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestBeanMap.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestBeanMap.java 5 Oct 2003 20:46:40 -0000 1.12
+++ TestBeanMap.java 7 Oct 2003 22:20:57 -0000 1.13
@@ -253,14 +253,23 @@
}
/**
- * The mappings in a BeanMap are fixed on the properties the underlying
- * bean has. Adding and removing mappings is not possible, thus this
- * method is overridden to return false.
- **/
- protected boolean isAddRemoveModifiable() {
+ * The mappings in a BeanMap are fixed on the properties the underlying
+ * bean has. Adding and removing mappings is not possible, thus this
+ * method is overridden to return false.
+ */
+ protected boolean isPutAddSupported() {
return false;
}
-
+
+ /**
+ * The mappings in a BeanMap are fixed on the properties the underlying
+ * bean has. Adding and removing mappings is not possible, thus this
+ * method is overridden to return false.
+ */
+ protected boolean isRemoveSupported() {
+ return false;
+ }
+
protected Map makeFullMap() {
// note: These values must match (i.e. .equals() must return true)
// those returned from getSampleValues().
@@ -299,16 +308,24 @@
}
/**
- * Need to override this method because the "clear()" method on the bean
- * map just returns the bean properties to their default states. It does
- * not actually remove the mappings as per the map contract. The default
- * testClear() methods checks that the clear method throws an
- * UnsupportedOperationException since this class is not add/remove
- * modifiable. In our case though, we do not always throw that exception.
- **/
- public void testClear() {
+ * Need to override this method because the "clear()" method on the bean
+ * map just returns the bean properties to their default states. It does
+ * not actually remove the mappings as per the map contract. The default
+ * testClear() methods checks that the clear method throws an
+ * UnsupportedOperationException since this class is not add/remove
+ * modifiable. In our case though, we do not always throw that exception.
+ */
+ public void testMapClear() {
//TODO: make sure a call to BeanMap.clear returns the bean to its
//default initialization values.
+ }
+
+ /**
+ * Need to override this method because the "put()" method on the bean
+ * doesn't work for this type of Map.
+ */
+ public void testMapPut() {
+ // see testBeanMapPutAllWriteable
}
public void testBeanMapClone() {
1.10 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/TestTreeMap.java
Index: TestTreeMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestTreeMap.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestTreeMap.java 5 Oct 2003 21:23:21 -0000 1.9
+++ TestTreeMap.java 7 Oct 2003 22:20:57 -0000 1.10
@@ -77,7 +77,7 @@
junit.textui.TestRunner.main(testCaseName);
}
- public boolean useNullKey() {
+ public boolean isAllowNullKey() {
return false;
}
1.12 +4 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastTreeMap.java
Index: TestFastTreeMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastTreeMap.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TestFastTreeMap.java 5 Oct 2003 21:11:06 -0000 1.11
+++ TestFastTreeMap.java 7 Oct 2003 22:20:57 -0000 1.12
@@ -97,7 +97,7 @@
/**
* The comparator for the fast tree map does not support null keys.
**/
- public boolean useNullKey() {
+ public boolean isAllowNullKey() {
return false;
}
@@ -105,7 +105,7 @@
* There is a bug in JDK1.2.2 TreeMap; the keySet will incorrectly
* return false when a null value is removed
*/
- public boolean useNullValue() {
+ public boolean isAllowNullValue() {
return false;
}
1.5 +7 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestFixedSizeSortedMap.java
Index: TestFixedSizeSortedMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestFixedSizeSortedMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestFixedSizeSortedMap.java 2 Oct 2003 23:01:09 -0000 1.4
+++ TestFixedSizeSortedMap.java 7 Oct 2003 22:20:58 -0000 1.5
@@ -100,7 +100,11 @@
return FixedSizeSortedMap.decorate(map);
}
- protected boolean isAddRemoveModifiable() {
+ protected boolean isPutAddSupported() {
+ return false;
+ }
+
+ protected boolean isRemoveSupported() {
return false;
}
1.3 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestLazySortedMap.java
Index: TestLazySortedMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestLazySortedMap.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestLazySortedMap.java 20 Sep 2003 17:05:36 -0000 1.2
+++ TestLazySortedMap.java 7 Oct 2003 22:20:58 -0000 1.3
@@ -103,7 +103,7 @@
return decorateMap(new TreeMap(), nullFactory);
}
- protected boolean useNullKey() {
+ protected boolean isAllowNullKey() {
return false;
}
1.3 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestPredicatedSortedMap.java
Index: TestPredicatedSortedMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestPredicatedSortedMap.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestPredicatedSortedMap.java 20 Sep 2003 17:05:36 -0000 1.2
+++ TestPredicatedSortedMap.java 7 Oct 2003 22:20:58 -0000 1.3
@@ -106,7 +106,7 @@
return decorateMap(new TreeMap(), testPredicate, testPredicate);
}
- protected boolean useNullKey() {
+ protected boolean isAllowNullKey() {
return false;
}
1.2 +8 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestUnmodifiableMap.java
Index: TestUnmodifiableMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestUnmodifiableMap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestUnmodifiableMap.java 6 Oct 2003 05:06:05 -0000 1.1
+++ TestUnmodifiableMap.java 7 Oct 2003 22:20:58 -0000 1.2
@@ -99,11 +99,15 @@
return UnmodifiableMap.decorate(new HashMap());
}
- protected boolean isChangeable() {
+ protected boolean isPutChangeSupported() {
return false;
}
- protected boolean isAddRemoveModifiable() {
+ protected boolean isPutAddSupported() {
+ return false;
+ }
+
+ protected boolean isRemoveSupported() {
return false;
}
1.5 +7 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestFixedSizeMap.java
Index: TestFixedSizeMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/decorators/TestFixedSizeMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestFixedSizeMap.java 2 Oct 2003 23:01:09 -0000 1.4
+++ TestFixedSizeMap.java 7 Oct 2003 22:20:58 -0000 1.5
@@ -99,7 +99,11 @@
return FixedSizeMap.decorate(map);
}
- protected boolean isAddRemoveModifiable() {
+ protected boolean isPutAddSupported() {
+ return false;
+ }
+
+ protected boolean isRemoveSupported() {
return false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org