Rework build script for new test classes

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131346 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-11-16 21:39:42 +00:00
parent fc74d8d13d
commit 9ccb68523b
4 changed files with 39 additions and 18 deletions

View File

@ -1,4 +1,4 @@
<!-- $Id: build.xml,v 1.50 2003/10/29 00:06:25 scolebourne Exp $ --> <!-- $Id: build.xml,v 1.51 2003/11/16 21:39:42 scolebourne Exp $ -->
<project name="commons-collections" default="test" basedir="."> <project name="commons-collections" default="test" basedir=".">
<!-- patternset describing files to be copied from the doc directory --> <!-- patternset describing files to be copied from the doc directory -->
@ -38,7 +38,12 @@
<include name="**/Bag.java"/> <include name="**/Bag.java"/>
<include name="**/BidiMap.java"/> <include name="**/BidiMap.java"/>
<include name="**/MapIterator.java"/> <include name="**/MapIterator.java"/>
<include name="**/OrderedBidiMap.java"/>
<include name="**/OrderedIterator.java"/>
<include name="**/map/OrderedMap.java"/>
<include name="**/OrderedMapIterator.java"/>
<include name="**/SortedBag.java"/> <include name="**/SortedBag.java"/>
<include name="**/SortedBidiMap.java"/>
<include name="**/AbstractTest*.java"/> <include name="**/AbstractTest*.java"/>
<include name="**/BulkTest*.java"/> <include name="**/BulkTest*.java"/>
</patternset> </patternset>

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/AbstractTestCollection.java,v 1.8 2003/11/04 23:34:46 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/AbstractTestCollection.java,v 1.9 2003/11/16 21:39:42 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -63,14 +63,13 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.apache.commons.collections.pairs.DefaultMapEntry;
/** /**
* Abstract test class for {@link java.util.Collection} methods and contracts. * Abstract test class for {@link java.util.Collection} methods and contracts.
* <p> * <p>
@ -148,7 +147,7 @@ import org.apache.commons.collections.pairs.DefaultMapEntry;
* you may still use this base set of cases. Simply override the * you may still use this base set of cases. Simply override the
* test case (method) your {@link Collection} fails. * test case (method) your {@link Collection} fails.
* *
* @version $Revision: 1.8 $ $Date: 2003/11/04 23:34:46 $ * @version $Revision: 1.9 $ $Date: 2003/11/16 21:39:42 $
* *
* @author Rodney Waldhoff * @author Rodney Waldhoff
* @author Paul Jack * @author Paul Jack
@ -405,6 +404,15 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
return makeCollection(); return makeCollection();
} }
/**
* Creates a new Map Entry that is independent of the first and the map.
*/
protected Map.Entry cloneMapEntry(Map.Entry entry) {
HashMap map = new HashMap();
map.put(entry.getKey(), entry.getValue());
return (Map.Entry) map.entrySet().iterator().next();
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**
* Returns an array of objects that are contained in a collection * Returns an array of objects that are contained in a collection
@ -850,7 +858,7 @@ public abstract class AbstractTestCollection extends AbstractTestObject {
// TreeMap reuses the Map Entry, so the verify below fails // TreeMap reuses the Map Entry, so the verify below fails
// Clone it here if necessary // Clone it here if necessary
if (o instanceof Map.Entry) { if (o instanceof Map.Entry) {
o = new DefaultMapEntry((Map.Entry) o); o = cloneMapEntry((Map.Entry) o);
} }
iter.remove(); iter.remove();

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.12 2003/11/04 23:35:35 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.13 2003/11/16 21:39:42 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -153,7 +153,7 @@ import java.util.Set;
* @author Rodney Waldhoff * @author Rodney Waldhoff
* @author Paul Jack * @author Paul Jack
* @author Stephen Colebourne * @author Stephen Colebourne
* @version $Revision: 1.12 $ $Date: 2003/11/04 23:35:35 $ * @version $Revision: 1.13 $ $Date: 2003/11/16 21:39:42 $
*/ */
public abstract class AbstractTestMap extends AbstractTestObject { public abstract class AbstractTestMap extends AbstractTestObject {
@ -435,6 +435,15 @@ public abstract class AbstractTestMap extends AbstractTestObject {
return new HashMap(); return new HashMap();
} }
/**
* Creates a new Map Entry that is independent of the first and the map.
*/
protected Map.Entry cloneMapEntry(Map.Entry entry) {
HashMap map = new HashMap();
map.put(entry.getKey(), entry.getValue());
return (Map.Entry) map.entrySet().iterator().next();
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**
* Test to ensure the test setup is working properly. This method checks * Test to ensure the test setup is working properly. This method checks

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/bidimap/AbstractTestSortedBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java,v 1.2 2003/11/16 21:39:42 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -71,12 +71,11 @@ import java.util.TreeSet;
import org.apache.commons.collections.AbstractTestSortedMap; import org.apache.commons.collections.AbstractTestSortedMap;
import org.apache.commons.collections.BulkTest; import org.apache.commons.collections.BulkTest;
import org.apache.commons.collections.pairs.DefaultMapEntry;
/** /**
* Abstract test class for {@link BidiMap} methods and contracts. * Abstract test class for {@link SortedBidiMap} methods and contracts.
* *
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $ * @version $Revision: 1.2 $ $Date: 2003/11/16 21:39:42 $
* *
* @author Matthew Hawthorne * @author Matthew Hawthorne
* @author Stephen Colebourne * @author Stephen Colebourne
@ -253,8 +252,8 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
assertEquals(2, set.size()); assertEquals(2, set.size());
Iterator it2 = set.iterator(); Iterator it2 = set.iterator();
Map.Entry firstEntry = new DefaultMapEntry((Map.Entry) it2.next()); Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
Map.Entry secondEntry = new DefaultMapEntry((Map.Entry) it2.next()); Map.Entry secondEntry = cloneMapEntry((Map.Entry) it2.next());
assertEquals(true, sm.containsKey(first)); assertEquals(true, sm.containsKey(first));
assertEquals(true, sub.containsKey(first)); assertEquals(true, sub.containsKey(first));
assertEquals(true, set.contains(firstEntry)); assertEquals(true, set.contains(firstEntry));
@ -418,8 +417,8 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
Set set = sub.entrySet(); Set set = sub.entrySet();
Iterator it2 = set.iterator(); Iterator it2 = set.iterator();
Object fromEntry = it2.next(); Object fromEntry = it2.next();
Map.Entry firstEntry = new DefaultMapEntry((Map.Entry) it2.next()); Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
Map.Entry secondEntry = new DefaultMapEntry((Map.Entry) it2.next()); Map.Entry secondEntry = cloneMapEntry((Map.Entry) it2.next());
assertEquals(true, sm.containsKey(first)); assertEquals(true, sm.containsKey(first));
assertEquals(true, sub.containsKey(first)); assertEquals(true, sub.containsKey(first));
assertEquals(true, set.contains(firstEntry)); assertEquals(true, set.contains(firstEntry));
@ -601,8 +600,8 @@ public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiM
assertEquals(3, set.size()); assertEquals(3, set.size());
Iterator it2 = set.iterator(); Iterator it2 = set.iterator();
Object fromEntry = it2.next(); Object fromEntry = it2.next();
Map.Entry firstEntry = new DefaultMapEntry((Map.Entry) it2.next()); Map.Entry firstEntry = cloneMapEntry((Map.Entry) it2.next());
Map.Entry secondEntry = new DefaultMapEntry((Map.Entry) it2.next()); Map.Entry secondEntry = cloneMapEntry((Map.Entry) it2.next());
assertEquals(true, sm.containsKey(first)); assertEquals(true, sm.containsKey(first));
assertEquals(true, sub.containsKey(first)); assertEquals(true, sub.containsKey(first));
assertEquals(true, set.contains(firstEntry)); assertEquals(true, set.contains(firstEntry));