From 831f19ee7349ff9373a8f8b921b39f3cee855c11 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 21 Jun 2002 03:32:06 +0000 Subject: [PATCH] Removed the deprecated method from TestCollection, as no one uses it anymore. Modified TestCursorableLinkedList so that serialization tests on sublists and sub-sublists are ignored. Submitted by: Paul Jack ( pjack at sfaf dot org ) git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130732 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections/TestCollection.java | 39 ++----------------- .../collections/TestCursorableLinkedList.java | 34 ++++++++++++++-- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/src/test/org/apache/commons/collections/TestCollection.java b/src/test/org/apache/commons/collections/TestCollection.java index 452b39e13..4251f01d9 100644 --- a/src/test/org/apache/commons/collections/TestCollection.java +++ b/src/test/org/apache/commons/collections/TestCollection.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestCollection.java,v 1.7 2002/06/18 02:51:12 mas Exp $ - * $Revision: 1.7 $ - * $Date: 2002/06/18 02:51:12 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestCollection.java,v 1.8 2002/06/21 03:32:06 mas Exp $ + * $Revision: 1.8 $ + * $Date: 2002/06/21 03:32:06 $ * * ==================================================================== * @@ -157,7 +157,7 @@ import java.util.Set; * @author Rodney Waldhoff * @author Paul Jack * @author Michael A. Smith - * @version $Id: TestCollection.java,v 1.7 2002/06/18 02:51:12 mas Exp $ + * @version $Id: TestCollection.java,v 1.8 2002/06/21 03:32:06 mas Exp $ */ public abstract class TestCollection extends TestObject { @@ -1209,37 +1209,6 @@ public abstract class TestCollection extends TestObject { } - /** - * Try to add the given object to the given Collection. - * Returns true if the element was added, - * false otherwise. - * - * Fails any Throwable except UnsupportedOperationException, - * ClassCastException, or IllegalArgumentException is thrown. - * - * @deprecated explicitly check for allowed exceptions rather than using - * this method to assume any of UnsupportedOperationException, - * ClassCaseException, or IllegalArgumentException are allowed. - */ - protected boolean tryToAdd(Collection c,Object obj) { - // FIXME: Delete this method after TestList is patched - try { - return c.add(obj); - } catch(UnsupportedOperationException e) { - return false; - } catch(ClassCastException e) { - return false; - } catch(IllegalArgumentException e) { - return false; - } catch(Throwable t) { - t.printStackTrace(); - fail("Collection.add should only throw UnsupportedOperationException, ClassCastException or IllegalArgumentException. Found " + t.toString()); - return false; // never get here, since fail throws exception - } - } - - - /** * Returns a list of elements suitable for return by * {@link getFullElements()}. The array returned by this method diff --git a/src/test/org/apache/commons/collections/TestCursorableLinkedList.java b/src/test/org/apache/commons/collections/TestCursorableLinkedList.java index eb78d4d2b..263f83934 100644 --- a/src/test/org/apache/commons/collections/TestCursorableLinkedList.java +++ b/src/test/org/apache/commons/collections/TestCursorableLinkedList.java @@ -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.5 2002/06/18 05:35:58 mas Exp $ - * $Revision: 1.5 $ - * $Date: 2002/06/18 05:35:58 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java,v 1.6 2002/06/21 03:32:06 mas Exp $ + * $Revision: 1.6 $ + * $Date: 2002/06/21 03:32:06 $ * * ==================================================================== * @@ -66,7 +66,7 @@ import java.util.*; /** * @author Rodney Waldhoff - * @version $Id: TestCursorableLinkedList.java,v 1.5 2002/06/18 05:35:58 mas Exp $ + * @version $Id: TestCursorableLinkedList.java,v 1.6 2002/06/21 03:32:06 mas Exp $ */ public class TestCursorableLinkedList extends TestList { public TestCursorableLinkedList(String testName) { @@ -949,4 +949,30 @@ public class TestCursorableLinkedList extends TestList { assertTrue(list.equals(list2)); } + + /** + * Ignore the serialization tests for sublists and sub-sublists. + * + * @return an array of sublist serialization test names + */ + public String[] ignoredSimpleTests() { + ArrayList list = new ArrayList(); + String prefix = "TestCursorableLinkedList"; + String bulk = ".bulkTestSubList"; + String[] ignored = new String[] { + ".testEmptyListSerialization", + ".testFullListSerialization", + ".testEmptyListCompatibility", + ".testFullListCompatibility", + ".testSimpleSerialization", + ".testCanonicalEmptyCollectionExists", + ".testCanonicalFullCollectionExists" + }; + for (int i = 0; i < ignored.length; i++) { + list.add(prefix + bulk + ignored[i]); + list.add(prefix + bulk + bulk + ignored[i]); + } + return (String[])list.toArray(new String[0]); + } + }