Enhance Map tests pre-release of testframework

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131255 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-10-07 22:20:58 +00:00
parent b943acfc64
commit e7ea37d1a7
15 changed files with 288 additions and 189 deletions

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestMap.java,v 1.3 2003/10/05 20:47:37 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestMap.java,v 1.4 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -79,32 +79,33 @@ import java.util.Set;
* 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>
*
* <B>Supported Operation Methods</B><P>
* <ul>
* <li>{@link #getSampleKeys()}
* <li>{@link #getSampleValues()}
* <li>{@link #getNewSampleValues()}
* <li>{@link #getOtherKeys()}
* <li>{@link #getOtherValues()}
* </ul>
*
* <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,19 +140,19 @@ import java.util.Set;
* {@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
* @author Paul Jack
* @author Stephen Colebourne
* @version $Revision: 1.3 $ $Date: 2003/10/05 20:47:37 $
* @version $Revision: 1.4 $ $Date: 2003/10/07 22:20:57 $
*/
public abstract class AbstractTestMap extends AbstractTestObject {
@ -179,7 +180,6 @@ public abstract class AbstractTestMap extends AbstractTestObject {
/** HashMap created by reset(). */
protected Map confirmed;
/**
* JUnit constructor.
*
@ -189,44 +189,77 @@ public abstract class AbstractTestMap extends AbstractTestObject {
super(testName);
}
/**
* 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
* adding new mappings.
* <p>
* Default implementation returns true.
* Override if your collection class does not support put adding.
*/
protected boolean useNullKey() {
protected boolean isPutAddSupported() {
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>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 useNullValue() {
protected boolean isPutChangeSupported() {
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()}
* 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 useDuplicateValues() {
protected boolean isRemoveSupported() {
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 keys.
* <p>
* Default implementation returns true.
* Override if your collection class does not support null keys.
*/
protected boolean isChangeable() {
protected boolean isAllowNullKey() {
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 null values.
* <p>
* Default implementation returns true.
* Override if your collection class does not support null values.
*/
protected boolean isAddRemoveModifiable() {
protected boolean isAllowNullValue() {
return true;
}
/**
* 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 isAllowDuplicateValues() {
return true;
}
@ -235,7 +268,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* 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 @@ public abstract class AbstractTestMap extends AbstractTestObject {
"hello", "goodbye", "we'll", "see", "you", "all", "again",
"key",
"key2",
(useNullKey()) ? null : "nonnullkey"
(isAllowNullKey()) ? null : "nonnullkey"
};
return result;
}
@ -272,20 +305,20 @@ public abstract class AbstractTestMap extends AbstractTestObject {
/**
* 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
* 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;
}
@ -296,16 +329,16 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* 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
* 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 @@ public abstract class AbstractTestMap extends AbstractTestObject {
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);
}
@ -384,9 +417,9 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* 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
* isNullKeySupported() 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.
* isAllowDuplicateValues() returns true.
*/
public void testSampleMappings() {
Object[] keys = getSampleKeys();
@ -417,12 +450,12 @@ public abstract class AbstractTestMap extends AbstractTestObject {
(!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 @@ public abstract class AbstractTestMap extends AbstractTestObject {
}
/**
* 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 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* 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,15 +733,13 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* 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++) {
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();
@ -711,32 +749,57 @@ public abstract class AbstractTestMap extends AbstractTestObject {
assertTrue("Map should contain value after put",
map.containsValue(values[i]));
}
for(int i = 0; i < keys.length; 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("Second map.put should return previous value",
assertEquals("Map.put should return previous value when changed",
values[i], o);
assertTrue("Map should still contain key after put",
assertTrue("Map should still contain key after put when changed",
map.containsKey(keys[i]));
assertTrue("Map should contain new value after put",
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(!useDuplicateValues()) {
assertTrue("Map should not contain old value after second put",
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]));
}
}
}
}
/**
* Tests Map.putAll(Collection)
*/
public void testMapPutAll() {
if (!isAddRemoveModifiable()) return;
if (!isPutAddSupported()) return;
resetEmpty();
@ -764,7 +827,14 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* 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 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* the underlying map for clear().
*/
public void testValuesClearChangesMap() {
if (!isAddRemoveModifiable()) return;
if (!isRemoveSupported()) return;
// clear values, reflected in map
resetFull();
@ -833,7 +903,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* the underlying map for clear().
*/
public void testKeySetClearChangesMap() {
if (!isAddRemoveModifiable()) return;
if (!isRemoveSupported()) return;
// clear values, reflected in map
resetFull();
@ -859,7 +929,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
* the underlying map for clear().
*/
public void testEntrySetClearChangesMap() {
if (!isAddRemoveModifiable()) return;
if (!isRemoveSupported()) return;
// clear values, reflected in map
resetFull();
@ -1007,7 +1077,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
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 @@ public abstract class AbstractTestMap extends AbstractTestObject {
}
protected boolean isRemoveSupported() {
return isAddRemoveModifiable();
return AbstractTestMap.this.isRemoveSupported();
}
protected void resetEmpty() {
@ -1127,7 +1197,7 @@ public abstract class AbstractTestMap extends AbstractTestObject {
}
protected boolean isRemoveSupported() {
return isAddRemoveModifiable();
return AbstractTestMap.this.isRemoveSupported();
}
protected boolean areEqualElementsDistinguishable() {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestSortedMap.java,v 1.2 2003/10/06 23:44:56 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestSortedMap.java,v 1.3 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -63,7 +63,7 @@ import java.util.SortedMap;
/**
* Abstract test class for {@link java.util.SortedMap} methods and contracts.
*
* @version $Revision: 1.2 $ $Date: 2003/10/06 23:44:56 $
* @version $Revision: 1.3 $ $Date: 2003/10/07 22:20:57 $
*
* @author Stephen Colebourne
*/
@ -84,7 +84,7 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap {
*
* @return false
*/
protected boolean useNullKey() {
protected boolean isAllowNullKey() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBeanMap.java,v 1.12 2003/10/05 20:46:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestBeanMap.java,v 1.13 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -66,7 +66,7 @@ import junit.framework.Test;
/**
* Test cases for BeanMap
*
* @version $Revision: 1.12 $ $Date: 2003/10/05 20:46:40 $
* @version $Revision: 1.13 $ $Date: 2003/10/07 22:20:57 $
*
* @author Morgan Delagrange
*/
@ -256,8 +256,17 @@ public class TestBeanMap extends AbstractTestMap {
* 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() {
*/
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;
}
@ -305,12 +314,20 @@ public class TestBeanMap extends AbstractTestMap {
* 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() {
*/
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() {
BeanMap map = (BeanMap)makeFullMap();
try {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestBidiMap.java,v 1.5 2003/10/06 23:47:17 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestBidiMap.java,v 1.6 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -63,7 +63,7 @@ import java.util.Map;
/**
* JUnit tests.
*
* @version $Revision: 1.5 $ $Date: 2003/10/06 23:47:17 $
* @version $Revision: 1.6 $ $Date: 2003/10/07 22:20:57 $
*
* @author Matthew Hawthorne
*/
@ -128,7 +128,7 @@ public abstract class TestBidiMap extends AbstractTestMap {
/**
* Override to indicate to AbstractTestMap this is a BidiMap.
*/
protected boolean useDuplicateValues() {
protected boolean isAllowDuplicateValues() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java,v 1.9 2003/10/05 21:11:06 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestDoubleOrderedMap.java,v 1.10 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -77,7 +77,7 @@ import junit.framework.Test;
* Map that does not support duplicate keys, duplicate
* values, or null values.
*
* @version $Revision: 1.9 $ $Date: 2003/10/05 21:11:06 $
* @version $Revision: 1.10 $ $Date: 2003/10/07 22:20:57 $
*
* @author Marc Johnson (marcj at users dot sourceforge dot net)
*/
@ -104,7 +104,7 @@ public class TestDoubleOrderedMap extends AbstractTestMap {
/**
* The default comparator in double ordered map does not allow null keys.
**/
public boolean useNullKey() {
public boolean isAllowNullKey() {
return false;
}
@ -112,14 +112,14 @@ public class TestDoubleOrderedMap extends AbstractTestMap {
* 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;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastHashMap.java,v 1.11 2003/10/05 21:11:06 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastHashMap.java,v 1.12 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -64,7 +64,7 @@ import junit.framework.Test;
/**
* Tests FastHashMap.
*
* @version $Revision: 1.11 $ $Date: 2003/10/05 21:11:06 $
* @version $Revision: 1.12 $ $Date: 2003/10/07 22:20:57 $
*
* @author Jason van Zyl
*/
@ -93,7 +93,7 @@ public class TestFastHashMap extends AbstractTestMap {
* 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;
}
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastTreeMap.java,v 1.11 2003/10/05 21:11:06 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastTreeMap.java,v 1.12 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -65,7 +65,7 @@ import junit.framework.Test;
/**
* Tests FastTreeMap.
*
* @version $Revision: 1.11 $ $Date: 2003/10/05 21:11:06 $
* @version $Revision: 1.12 $ $Date: 2003/10/07 22:20:57 $
*
* @author Jason van Zyl
*/
@ -97,7 +97,7 @@ public class TestFastTreeMap extends TestTreeMap {
/**
* The comparator for the fast tree map does not support null keys.
**/
public boolean useNullKey() {
public boolean isAllowNullKey() {
return false;
}
@ -105,7 +105,7 @@ public class TestFastTreeMap extends TestTreeMap {
* 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;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMapUtils.java,v 1.17 2003/10/05 21:17:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMapUtils.java,v 1.18 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -76,7 +76,7 @@ import org.apache.commons.collections.decorators.PredicatedMap;
/**
* Tests for MapUtils.
*
* @version $Revision: 1.17 $ $Date: 2003/10/05 21:17:40 $
* @version $Revision: 1.18 $ $Date: 2003/10/07 22:20:57 $
*
* @author Stephen Colebourne
* @author Arun Mammen Thomas
@ -163,11 +163,11 @@ public class TestMapUtils extends BulkTest {
public BulkTest bulkTestTypedMap() {
return new AbstractTestMap("") {
public boolean useNullKey() {
public boolean isAllowNullKey() {
return false;
}
public boolean useNullValue() {
public boolean isAllowNullValue() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestReferenceMap.java,v 1.12 2003/10/05 21:23:21 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestReferenceMap.java,v 1.13 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -65,7 +65,7 @@ import junit.framework.Test;
/**
* Tests for ReferenceMap.
*
* @version $Revision: 1.12 $ $Date: 2003/10/05 21:23:21 $
* @version $Revision: 1.13 $ $Date: 2003/10/07 22:20:57 $
*
* @author Paul Jack
*/
@ -89,11 +89,11 @@ public class TestReferenceMap extends AbstractTestMap {
return map;
}
public boolean useNullKey() {
public boolean isAllowNullKey() {
return false;
}
public boolean useNullValue() {
public boolean isAllowNullValue() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeMap.java,v 1.9 2003/10/05 21:23:21 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestTreeMap.java,v 1.10 2003/10/07 22:20:57 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -62,7 +62,7 @@ import java.util.TreeMap;
/**
* Tests TreeMap.
*
* @version $Revision: 1.9 $ $Date: 2003/10/05 21:23:21 $
* @version $Revision: 1.10 $ $Date: 2003/10/07 22:20:57 $
*
* @author Jason van Zyl
*/
@ -77,7 +77,7 @@ public abstract class TestTreeMap extends AbstractTestMap {
junit.textui.TestRunner.main(testCaseName);
}
public boolean useNullKey() {
public boolean isAllowNullKey() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestFixedSizeMap.java,v 1.4 2003/10/02 23:01:09 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestFixedSizeMap.java,v 1.5 2003/10/07 22:20:58 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -70,7 +70,7 @@ import org.apache.commons.collections.AbstractTestMap;
* implementation.
*
* @since Commons Collections 3.0
* @version $Revision: 1.4 $ $Date: 2003/10/02 23:01:09 $
* @version $Revision: 1.5 $ $Date: 2003/10/07 22:20:58 $
*
* @author Stephen Colebourne
*/
@ -99,7 +99,11 @@ public class TestFixedSizeMap extends AbstractTestMap {
return FixedSizeMap.decorate(map);
}
protected boolean isAddRemoveModifiable() {
protected boolean isPutAddSupported() {
return false;
}
protected boolean isRemoveSupported() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestFixedSizeSortedMap.java,v 1.4 2003/10/02 23:01:09 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestFixedSizeSortedMap.java,v 1.5 2003/10/07 22:20:58 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -71,7 +71,7 @@ import org.apache.commons.collections.AbstractTestSortedMap;
* implementation.
*
* @since Commons Collections 3.0
* @version $Revision: 1.4 $ $Date: 2003/10/02 23:01:09 $
* @version $Revision: 1.5 $ $Date: 2003/10/07 22:20:58 $
*
* @author Stephen Colebourne
*/
@ -100,7 +100,11 @@ public class TestFixedSizeSortedMap extends AbstractTestSortedMap {
return FixedSizeSortedMap.decorate(map);
}
protected boolean isAddRemoveModifiable() {
protected boolean isPutAddSupported() {
return false;
}
protected boolean isRemoveSupported() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestLazySortedMap.java,v 1.2 2003/09/20 17:05:36 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestLazySortedMap.java,v 1.3 2003/10/07 22:20:58 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -74,7 +74,7 @@ import org.apache.commons.collections.TransformerUtils;
* {@link LazySortedMap} implementation.
*
* @since Commons Collections 3.0
* @version $Revision: 1.2 $ $Date: 2003/09/20 17:05:36 $
* @version $Revision: 1.3 $ $Date: 2003/10/07 22:20:58 $
*
* @author Phil Steitz
*/
@ -103,7 +103,7 @@ public class TestLazySortedMap extends TestLazyMap {
return decorateMap(new TreeMap(), nullFactory);
}
protected boolean useNullKey() {
protected boolean isAllowNullKey() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestPredicatedSortedMap.java,v 1.2 2003/09/20 17:05:36 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestPredicatedSortedMap.java,v 1.3 2003/10/07 22:20:58 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -72,7 +72,7 @@ import org.apache.commons.collections.Predicate;
* {@link PredicatedSortedMap} implementation.
*
* @since Commons Collections 3.0
* @version $Revision: 1.2 $ $Date: 2003/09/20 17:05:36 $
* @version $Revision: 1.3 $ $Date: 2003/10/07 22:20:58 $
*
* @author Phil Steitz
*/
@ -106,7 +106,7 @@ public class TestPredicatedSortedMap extends TestPredicatedMap{
return decorateMap(new TreeMap(), testPredicate, testPredicate);
}
protected boolean useNullKey() {
protected boolean isAllowNullKey() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestUnmodifiableMap.java,v 1.1 2003/10/06 05:06:05 psteitz Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/decorators/Attic/TestUnmodifiableMap.java,v 1.2 2003/10/07 22:20:58 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -74,7 +74,7 @@ import org.apache.commons.collections.AbstractTestMap;
* {@link UnmodifiableMap} implementation.
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/10/06 05:06:05 $
* @version $Revision: 1.2 $ $Date: 2003/10/07 22:20:58 $
*
* @author Phil Steitz
*/
@ -99,11 +99,15 @@ public class TestUnmodifiableMap extends AbstractTestMap{
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;
}