merged with HEAD
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/branches/collections_1_x_branch@130605 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37f759c0a8
commit
a1fdbead61
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.15.2.3 2002/02/26 06:17:51 morgand Exp $
|
||||
* $Revision: 1.15.2.3 $
|
||||
* $Date: 2002/02/26 06:17:51 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestAll.java,v 1.15.2.4 2002/02/26 20:23:10 morgand Exp $
|
||||
* $Revision: 1.15.2.4 $
|
||||
* $Date: 2002/02/26 20:23:10 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ import junit.framework.*;
|
|||
/**
|
||||
* Entry point for all Collections tests.
|
||||
* @author Rodney Waldhoff
|
||||
* @version $Id: TestAll.java,v 1.15.2.3 2002/02/26 06:17:51 morgand Exp $
|
||||
* @version $Id: TestAll.java,v 1.15.2.4 2002/02/26 20:23:10 morgand Exp $
|
||||
*/
|
||||
public class TestAll extends TestCase {
|
||||
public TestAll(String testName) {
|
||||
|
@ -76,7 +76,6 @@ public class TestAll extends TestCase {
|
|||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite();
|
||||
suite.addTest(TestArrayIterator.suite());
|
||||
suite.addTest(TestArrayList.suite());
|
||||
suite.addTest(TestArrayStack.suite());
|
||||
suite.addTest(TestCollectionUtils.suite());
|
||||
suite.addTest(TestCursorableLinkedList.suite());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestArrayList.java,v 1.2 2001/07/14 23:33:26 craigmcc Exp $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2001/07/14 23:33:26 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestArrayList.java,v 1.2.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
* $Revision: 1.2.2.1 $
|
||||
* $Date: 2002/02/26 20:23:10 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -69,9 +69,9 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
|
||||
* @version $Id: TestArrayList.java,v 1.2 2001/07/14 23:33:26 craigmcc Exp $
|
||||
* @version $Id: TestArrayList.java,v 1.2.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
*/
|
||||
public class TestArrayList extends TestList
|
||||
public abstract class TestArrayList extends TestList
|
||||
{
|
||||
public TestArrayList(String testName)
|
||||
{
|
||||
|
@ -93,13 +93,7 @@ public class TestArrayList extends TestList
|
|||
|
||||
public void setUp()
|
||||
{
|
||||
list = (ArrayList) makeList();
|
||||
}
|
||||
|
||||
public List makeList()
|
||||
{
|
||||
ArrayList al = new ArrayList();
|
||||
return (al);
|
||||
list = (ArrayList) makeEmptyList();
|
||||
}
|
||||
|
||||
public void testNewArrayList()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestArrayStack.java,v 1.5 2001/07/14 23:33:26 craigmcc Exp $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2001/07/14 23:33:26 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestArrayStack.java,v 1.5.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
* $Revision: 1.5.2.1 $
|
||||
* $Date: 2002/02/26 20:23:10 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ import java.util.*;
|
|||
|
||||
/**
|
||||
* @author Craig McClanahan
|
||||
* @version $Id: TestArrayStack.java,v 1.5 2001/07/14 23:33:26 craigmcc Exp $
|
||||
* @version $Id: TestArrayStack.java,v 1.5.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
*/
|
||||
|
||||
public class TestArrayStack extends TestArrayList {
|
||||
|
@ -84,14 +84,14 @@ public class TestArrayStack extends TestArrayList {
|
|||
junit.textui.TestRunner.main(testCaseName);
|
||||
}
|
||||
|
||||
public List makeList() {
|
||||
public List makeEmptyList() {
|
||||
return new ArrayStack();
|
||||
}
|
||||
|
||||
protected ArrayStack stack = null;
|
||||
|
||||
public void setUp() {
|
||||
stack = (ArrayStack) makeList();
|
||||
stack = (ArrayStack) makeEmptyList();
|
||||
list = stack;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java,v 1.3 2001/07/14 23:33:27 craigmcc Exp $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2001/07/14 23:33:27 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java,v 1.3.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
* $Revision: 1.3.2.1 $
|
||||
* $Date: 2002/02/26 20:23:10 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ import java.util.*;
|
|||
|
||||
/**
|
||||
* @author Rodney Waldhoff
|
||||
* @version $Id: TestCursorableLinkedList.java,v 1.3 2001/07/14 23:33:27 craigmcc Exp $
|
||||
* @version $Id: TestCursorableLinkedList.java,v 1.3.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
*/
|
||||
public class TestCursorableLinkedList extends TestList {
|
||||
public TestCursorableLinkedList(String testName) {
|
||||
|
@ -88,7 +88,7 @@ public class TestCursorableLinkedList extends TestList {
|
|||
list = new CursorableLinkedList();
|
||||
}
|
||||
|
||||
public List makeList() {
|
||||
public List makeEmptyList() {
|
||||
return new CursorableLinkedList();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastArrayList.java,v 1.3 2001/04/21 12:22:30 craigmcc Exp $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2001/04/21 12:22:30 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestFastArrayList.java,v 1.3.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
* $Revision: 1.3.2.1 $
|
||||
* $Date: 2002/02/26 20:23:10 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
|
||||
* @version $Id: TestFastArrayList.java,v 1.3 2001/04/21 12:22:30 craigmcc Exp $
|
||||
* @version $Id: TestFastArrayList.java,v 1.3.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
*/
|
||||
public class TestFastArrayList extends TestArrayList
|
||||
{
|
||||
|
@ -91,10 +91,10 @@ public class TestFastArrayList extends TestArrayList
|
|||
|
||||
public void setUp()
|
||||
{
|
||||
list = (ArrayList) makeList();
|
||||
list = (ArrayList) makeEmptyList();
|
||||
}
|
||||
|
||||
public List makeList()
|
||||
public List makeEmptyList()
|
||||
{
|
||||
FastArrayList fal = new FastArrayList();
|
||||
fal.setFast(false);
|
||||
|
|
|
@ -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.5 2001/07/14 23:33:27 craigmcc Exp $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 2001/07/14 23:33:27 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestList.java,v 1.5.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
* $Revision: 1.5.2.1 $
|
||||
* $Date: 2002/02/26 20:23:10 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -62,6 +62,8 @@
|
|||
package org.apache.commons.collections;
|
||||
|
||||
import junit.framework.*;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Arrays;
|
||||
|
@ -80,7 +82,7 @@ import java.util.ListIterator;
|
|||
* test case (method) your {@link List} fails.
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @version $Id: TestList.java,v 1.5 2001/07/14 23:33:27 craigmcc Exp $
|
||||
* @version $Id: TestList.java,v 1.5.2.1 2002/02/26 20:23:10 morgand Exp $
|
||||
*/
|
||||
public abstract class TestList extends TestCollection {
|
||||
public TestList(String testName) {
|
||||
|
@ -90,14 +92,30 @@ public abstract class TestList extends TestCollection {
|
|||
/**
|
||||
* Return a new, empty {@link List} to used for testing.
|
||||
*/
|
||||
public abstract List makeList();
|
||||
public abstract List makeEmptyList();
|
||||
|
||||
public List makeFullList() {
|
||||
// only works if list supports optional "add(Object)"
|
||||
// and "add(int,Object)" operations
|
||||
List list = makeEmptyList();
|
||||
list.add("1");
|
||||
// must be able to add to the end this way
|
||||
list.add(list.size(),"4");
|
||||
// must support duplicates
|
||||
list.add("1");
|
||||
// must support insertions
|
||||
list.add(1,"3");
|
||||
|
||||
// resultant list: 1, 3, 4, 1
|
||||
return list;
|
||||
}
|
||||
|
||||
public Collection makeCollection() {
|
||||
return makeList();
|
||||
return makeEmptyList();
|
||||
}
|
||||
|
||||
public void testListAddByIndexBoundsChecking() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
|
||||
try {
|
||||
list.add(Integer.MIN_VALUE,"element");
|
||||
|
@ -153,7 +171,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListAddByIndexBoundsChecking2() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
boolean added = tryToAdd(list,"element");
|
||||
|
||||
try {
|
||||
|
@ -184,7 +202,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListAddByIndex() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
assertEquals(0,list.size());
|
||||
if(tryToAdd(list,0,"element2")) {
|
||||
assertEquals(1,list.size());
|
||||
|
@ -201,7 +219,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListAdd() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
if(tryToAdd(list,"1")) {
|
||||
assertTrue(list.contains("1"));
|
||||
if(tryToAdd(list,"2")) {
|
||||
|
@ -223,7 +241,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListEqualsSelf() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
assertTrue(list.equals(list));
|
||||
tryToAdd(list,"elt");
|
||||
assertTrue(list.equals(list));
|
||||
|
@ -232,7 +250,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListEqualsArrayList() {
|
||||
List list1 = makeList();
|
||||
List list1 = makeEmptyList();
|
||||
List list2 = new ArrayList();
|
||||
assertTrue(list1.equals(list2));
|
||||
assertEquals(list1.hashCode(),list2.hashCode());
|
||||
|
@ -252,8 +270,8 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListEquals() {
|
||||
List list1 = makeList();
|
||||
List list2 = makeList();
|
||||
List list1 = makeEmptyList();
|
||||
List list2 = makeEmptyList();
|
||||
assertTrue(list1.equals(list2));
|
||||
if(tryToAdd(list1,"a") && tryToAdd(list2,"a")) {
|
||||
assertTrue(list1.equals(list2));
|
||||
|
@ -270,7 +288,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListGetByIndex() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"a");
|
||||
tryToAdd(list,"b");
|
||||
tryToAdd(list,"c");
|
||||
|
@ -284,7 +302,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListGetByIndexBoundsChecking() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
|
||||
try {
|
||||
list.get(Integer.MIN_VALUE);
|
||||
|
@ -323,7 +341,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListGetByIndexBoundsChecking2() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
boolean added = tryToAdd(list,"a");
|
||||
|
||||
try {
|
||||
|
@ -356,7 +374,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListIndexOf() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"a");
|
||||
tryToAdd(list,"b");
|
||||
tryToAdd(list,"c");
|
||||
|
@ -371,7 +389,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListLastIndexOf1() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"a");
|
||||
tryToAdd(list,"b");
|
||||
tryToAdd(list,"c");
|
||||
|
@ -386,7 +404,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListLastIndexOf2() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"a");
|
||||
tryToAdd(list,"b");
|
||||
tryToAdd(list,"c");
|
||||
|
@ -434,7 +452,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListSetByIndexBoundsChecking() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
|
||||
try {
|
||||
list.set(Integer.MIN_VALUE,"a");
|
||||
|
@ -503,7 +521,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListSetByIndexBoundsChecking2() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element");
|
||||
tryToAdd(list,"element2");
|
||||
|
||||
|
@ -561,7 +579,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListSetByIndex() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element");
|
||||
tryToAdd(list,"element2");
|
||||
tryToAdd(list,"element3");
|
||||
|
@ -586,7 +604,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListRemoveByIndex() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element");
|
||||
tryToAdd(list,"element2");
|
||||
tryToAdd(list,"element3");
|
||||
|
@ -615,7 +633,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListRemoveByValue() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element1");
|
||||
tryToAdd(list,"element2");
|
||||
tryToAdd(list,"element3");
|
||||
|
@ -637,7 +655,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListListIteratorNextPrev() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element1");
|
||||
tryToAdd(list,"element2");
|
||||
tryToAdd(list,"element3");
|
||||
|
@ -667,7 +685,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListListIteratorNextIndexPrevIndex() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element1");
|
||||
tryToAdd(list,"element2");
|
||||
tryToAdd(list,"element3");
|
||||
|
@ -689,7 +707,7 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
|
||||
public void testListListIteratorSet() {
|
||||
List list = makeList();
|
||||
List list = makeEmptyList();
|
||||
tryToAdd(list,"element1");
|
||||
tryToAdd(list,"element2");
|
||||
tryToAdd(list,"element3");
|
||||
|
@ -782,4 +800,66 @@ public abstract class TestList extends TestCollection {
|
|||
}
|
||||
}
|
||||
|
||||
public void testEmptyListSerialization()
|
||||
throws IOException, ClassNotFoundException {
|
||||
List list = makeEmptyList();
|
||||
if (!(list instanceof Serializable)) return;
|
||||
|
||||
byte[] objekt = writeExternalFormToBytes((Serializable) list);
|
||||
List list2 = (List) readExternalFormFromBytes(objekt);
|
||||
|
||||
assertTrue("Both lists are empty",list.size() == 0);
|
||||
assertTrue("Both lists are empty",list2.size() == 0);
|
||||
}
|
||||
|
||||
public void testFullListSerialization()
|
||||
throws IOException, ClassNotFoundException {
|
||||
List list = makeFullList();
|
||||
if (!(list instanceof Serializable)) return;
|
||||
|
||||
byte[] objekt = writeExternalFormToBytes((Serializable) list);
|
||||
List list2 = (List) readExternalFormFromBytes(objekt);
|
||||
|
||||
assertEquals("Both lists are same size",list.size(), 4);
|
||||
assertEquals("Both lists are same size",list2.size(),4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the current serialized form of the List
|
||||
* against the canonical version in CVS.
|
||||
*/
|
||||
public void testEmptyListCompatibility() throws IOException, ClassNotFoundException {
|
||||
/**
|
||||
* Create canonical objects with this code
|
||||
List list = makeEmptyList();
|
||||
if (!(list instanceof Serializable)) return;
|
||||
|
||||
writeExternalFormToDisk((Serializable) list, getCanonicalEmptyCollectionName(list));
|
||||
*/
|
||||
|
||||
// test to make sure the canonical form has been preserved
|
||||
if (!(makeEmptyList() instanceof Serializable)) return;
|
||||
List list = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(makeEmptyList()));
|
||||
assertTrue("List is empty",list.size() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the current serialized form of the List
|
||||
* against the canonical version in CVS.
|
||||
*/
|
||||
public void testFullListCompatibility() throws IOException, ClassNotFoundException {
|
||||
/**
|
||||
* Create canonical objects with this code
|
||||
List list = makeFullList();
|
||||
if (!(list instanceof Serializable)) return;
|
||||
|
||||
writeExternalFormToDisk((Serializable) list, getCanonicalFullCollectionName(list));
|
||||
*/
|
||||
|
||||
// test to make sure the canonical form has been preserved
|
||||
if (!(makeFullList() instanceof Serializable)) return;
|
||||
List list = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(makeFullList()));
|
||||
assertEquals("List is the right size",list.size(), 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.3.2.3 2002/02/26 06:28:41 morgand Exp $
|
||||
* $Revision: 1.3.2.3 $
|
||||
* $Date: 2002/02/26 06:28:41 $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestMap.java,v 1.3.2.4 2002/02/26 20:18:53 morgand Exp $
|
||||
* $Revision: 1.3.2.4 $
|
||||
* $Date: 2002/02/26 20:18:53 $
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -87,7 +87,7 @@ import java.util.NoSuchElementException;
|
|||
*
|
||||
* @author Michael Smith
|
||||
* @author Rodney Waldhoff
|
||||
* @version $Id: TestMap.java,v 1.3.2.3 2002/02/26 06:28:41 morgand Exp $
|
||||
* @version $Id: TestMap.java,v 1.3.2.4 2002/02/26 20:18:53 morgand Exp $
|
||||
*/
|
||||
public abstract class TestMap extends TestObject {
|
||||
|
||||
|
@ -929,31 +929,6 @@ public abstract class TestMap extends TestObject {
|
|||
assertEquals("Both maps are same size",map2.size(),getSampleKeys().length);
|
||||
}
|
||||
|
||||
|
||||
public String getCanonicalEmptyMapName(Map map) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
retval.append("data/test/");
|
||||
String mapName = map.getClass().getName();
|
||||
mapName = mapName.substring(mapName.lastIndexOf(".")+1,mapName.length());
|
||||
retval.append(mapName);
|
||||
retval.append(".emptyMap.version");
|
||||
retval.append(getCompatibilityVersion());
|
||||
retval.append(".obj");
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
public String getCanonicalFullMapName(Map map) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
retval.append("data/test/");
|
||||
String mapName = map.getClass().getName();
|
||||
mapName = mapName.substring(mapName.lastIndexOf(".")+1,mapName.length());
|
||||
retval.append(mapName);
|
||||
retval.append(".fullMap.version");
|
||||
retval.append(getCompatibilityVersion());
|
||||
retval.append(".obj");
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the current serialized form of the Map
|
||||
* against the canonical version in CVS.
|
||||
|
@ -965,12 +940,12 @@ public abstract class TestMap extends TestObject {
|
|||
map = makeEmptyMap();
|
||||
if (!(map instanceof Serializable)) return;
|
||||
|
||||
writeExternalFormToDisk((Serializable) map, getCanonicalEmptyMapName(map));
|
||||
writeExternalFormToDisk((Serializable) map, getCanonicalEmptyCollectionName(map));
|
||||
*/
|
||||
|
||||
// test to make sure the canonical form has been preserved
|
||||
if (!(makeEmptyMap() instanceof Serializable)) return;
|
||||
map = (Map) readExternalFormFromDisk(getCanonicalEmptyMapName(makeEmptyMap()));
|
||||
map = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(makeEmptyMap()));
|
||||
assertTrue("Map is empty",map.isEmpty() == true);
|
||||
}
|
||||
|
||||
|
@ -986,12 +961,12 @@ public abstract class TestMap extends TestObject {
|
|||
map = makeFullMap();
|
||||
if (!(map instanceof Serializable)) return;
|
||||
|
||||
writeExternalFormToDisk((Serializable) map, getCanonicalFullMapName(map));
|
||||
writeExternalFormToDisk((Serializable) map, getCanonicalFullCollectionName(map));
|
||||
*/
|
||||
|
||||
// test to make sure the canonical form has been preserved
|
||||
if (!(makeFullMap() instanceof Serializable)) return;
|
||||
map = (Map) readExternalFormFromDisk(getCanonicalFullMapName(makeFullMap()));
|
||||
map = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(makeFullMap()));
|
||||
assertEquals("Map is the right size",map.size(), getSampleKeys().length);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.1.2.1 2002/02/26 00:48:14 morgand Exp $
|
||||
* $Revision: 1.1.2.1 $
|
||||
* $Date: 2002/02/26 00:48:14 $
|
||||
<<<<<<< TestObject.java
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.1.2.2 2002/02/26 20:18:53 morgand Exp $
|
||||
* $Revision: 1.1.2.2 $
|
||||
* $Date: 2002/02/26 20:18:53 $
|
||||
=======
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestObject.java,v 1.1.2.2 2002/02/26 20:18:53 morgand Exp $
|
||||
* $Revision: 1.1.2.2 $
|
||||
* $Date: 2002/02/26 20:18:53 $
|
||||
>>>>>>> 1.8
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
|
@ -90,7 +96,7 @@ import java.util.NoSuchElementException;
|
|||
* test case (method) your {@link Object} fails.
|
||||
*
|
||||
* @author Rodney Waldhoff
|
||||
* @version $Id: TestObject.java,v 1.1.2.1 2002/02/26 00:48:14 morgand Exp $
|
||||
* @version $Id: TestObject.java,v 1.1.2.2 2002/02/26 20:18:53 morgand Exp $
|
||||
*/
|
||||
public abstract class TestObject extends TestCase {
|
||||
public TestObject(String testName) {
|
||||
|
@ -235,4 +241,28 @@ public abstract class TestObject extends TestCase {
|
|||
Object p = readExternalFormFromBytes(objekt);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCanonicalEmptyCollectionName(Object object) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
retval.append("data/test/");
|
||||
String colName = object.getClass().getName();
|
||||
colName = colName.substring(colName.lastIndexOf(".")+1,colName.length());
|
||||
retval.append(colName);
|
||||
retval.append(".emptyCollection.version");
|
||||
retval.append(getCompatibilityVersion());
|
||||
retval.append(".obj");
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
public String getCanonicalFullCollectionName(Object object) {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
retval.append("data/test/");
|
||||
String colName = object.getClass().getName();
|
||||
colName = colName.substring(colName.lastIndexOf(".")+1,colName.length());
|
||||
retval.append(colName);
|
||||
retval.append(".fullCollection.version");
|
||||
retval.append(getCompatibilityVersion());
|
||||
retval.append(".obj");
|
||||
return retval.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue