You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ma...@apache.org on 2002/06/21 05:32:07 UTC

cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestCollection.java TestCursorableLinkedList.java

mas         2002/06/20 20:32:07

  Modified:    collections/src/test/org/apache/commons/collections
                        TestCollection.java TestCursorableLinkedList.java
  Log:
  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 )
  
  Revision  Changes    Path
  1.8       +4 -35     jakarta-commons/collections/src/test/org/apache/commons/collections/TestCollection.java
  
  Index: TestCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestCollection.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestCollection.java	18 Jun 2002 02:51:12 -0000	1.7
  +++ TestCollection.java	21 Jun 2002 03:32:06 -0000	1.8
  @@ -1210,37 +1210,6 @@
   
   
       /**
  -     * Try to add the given object to the given Collection.
  -     * Returns <tt>true</tt> if the element was added,
  -     * <tt>false</tt> 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
        *  does not include null, but does include a variety of objects 
  
  
  
  1.6       +30 -4     jakarta-commons/collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java
  
  Index: TestCursorableLinkedList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestCursorableLinkedList.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestCursorableLinkedList.java	18 Jun 2002 05:35:58 -0000	1.5
  +++ TestCursorableLinkedList.java	21 Jun 2002 03:32:06 -0000	1.6
  @@ -949,4 +949,30 @@
           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]);
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>