Enhanced TestCollection to more completely test the Collection contract. This

will be used to test straight Collection implementations and for collection
views of other collections (e.g. Map.values()).

Submitted by: Paul Jack ( pjack at sfaf dot org ).

Changed TestBag to extend from TestObject instead of TestCollection since the
Bag contract conflicts with the Collection contract.  This needs to be
addressed at some point.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130721 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Smith 2002-06-18 01:14:23 +00:00
parent aed28e1dd2
commit b79307f302
3 changed files with 1019 additions and 282 deletions

View File

@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestBag.java,v 1.3 2002/03/14 18:10:33 morgand Exp $
* $Revision: 1.3 $
* $Date: 2002/03/14 18:10:33 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestBag.java,v 1.4 2002/06/18 01:14:23 mas Exp $
* $Revision: 1.4 $
* $Date: 2002/06/18 01:14:23 $
*
* ====================================================================
*
@ -79,9 +79,13 @@ import java.util.List;
* test case (method) your {@link Bag} fails.
*
* @author Chuck Burdick
* @version $Id: TestBag.java,v 1.3 2002/03/14 18:10:33 morgand Exp $
* @version $Id: TestBag.java,v 1.4 2002/06/18 01:14:23 mas Exp $
*/
public abstract class TestBag extends TestCollection {
// TODO: this class should really extend from TestCollection, but the bag
// implementations currently do not conform to the Collection interface. Once
// those are fixed or at least a strategy is made for resolving the issue, this
// can be changed back to extend TestCollection instead.
public abstract class TestBag extends TestObject {
public TestBag(String testName) {
super(testName);
}
@ -91,7 +95,7 @@ public abstract class TestBag extends TestCollection {
*/
public abstract Bag makeBag();
public Collection makeCollection() {
public Object makeObject() {
return makeBag();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestList.java,v 1.8 2002/02/26 18:45:46 morgand Exp $
* $Revision: 1.8 $
* $Date: 2002/02/26 18:45:46 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestList.java,v 1.9 2002/06/18 01:14:23 mas Exp $
* $Revision: 1.9 $
* $Date: 2002/06/18 01:14:23 $
*
* ====================================================================
*
@ -82,7 +82,7 @@ import java.util.ListIterator;
* test case (method) your {@link List} fails.
*
* @author Rodney Waldhoff
* @version $Id: TestList.java,v 1.8 2002/02/26 18:45:46 morgand Exp $
* @version $Id: TestList.java,v 1.9 2002/06/18 01:14:23 mas Exp $
*/
public abstract class TestList extends TestCollection {
public TestList(String testName) {
@ -862,4 +862,14 @@ public abstract class TestList extends TestCollection {
assertEquals("List is the right size",list.size(), 4);
}
protected Collection makeConfirmedCollection() {
ArrayList list = new ArrayList();
return list;
}
protected Collection makeConfirmedFullCollection() {
ArrayList list = new ArrayList();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
}