commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/collection AbstractTestCollection.java
Date Mon, 31 May 2004 19:09:15 GMT
scolebourne    2004/05/31 12:09:15

  Modified:    collections/src/test/org/apache/commons/collections/list
                        AbstractTestList.java
               collections/src/test/org/apache/commons/collections/set
                        AbstractTestSet.java
               collections/src/test/org/apache/commons/collections/collection
                        AbstractTestCollection.java
  Log:
  Add isEqualsCheckable and fix testSerializeDeserializeThenCompare in Collection
  
  Revision  Changes    Path
  1.8       +8 -1      jakarta-commons/collections/src/test/org/apache/commons/collections/list/AbstractTestList.java
  
  Index: AbstractTestList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/list/AbstractTestList.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractTestList.java	12 May 2004 22:20:54 -0000	1.7
  +++ AbstractTestList.java	31 May 2004 19:09:14 -0000	1.8
  @@ -110,6 +110,13 @@
   
       //-----------------------------------------------------------------------
       /**
  +     * List equals method is defined.
  +     */
  +    public boolean isEqualsCheckable() {
  +        return true;
  +    }
  +
  +    /**
        * Returns an empty {@link ArrayList}.
        */
       public Collection makeConfirmedCollection() {
  
  
  
  1.5       +8 -1      jakarta-commons/collections/src/test/org/apache/commons/collections/set/AbstractTestSet.java
  
  Index: AbstractTestSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/set/AbstractTestSet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractTestSet.java	18 Feb 2004 01:20:39 -0000	1.4
  +++ AbstractTestSet.java	31 May 2004 19:09:14 -0000	1.5
  @@ -73,6 +73,13 @@
   
       //-----------------------------------------------------------------------
       /**
  +     * Set equals method is defined.
  +     */
  +    public boolean isEqualsCheckable() {
  +        return true;
  +    }
  +
  +    /**
        * Returns an empty Set for use in modification testing.
        *
        * @return a confirmed empty collection
  
  
  
  1.6       +16 -3     jakarta-commons/collections/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java
  
  Index: AbstractTestCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/collection/AbstractTestCollection.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTestCollection.java	9 Apr 2004 15:16:24 -0000	1.5
  +++ AbstractTestCollection.java	31 May 2004 19:09:14 -0000	1.6
  @@ -228,6 +228,14 @@
           return false;
       }
   
  +    /**
  +     * Returns true to indicate that the collection supports equals() comparisons.
  +     * The default implementation returns false;
  +     */
  +    public boolean isEqualsCheckable() {
  +        return false;
  +    }
  +
       //-----------------------------------------------------------------------
       /**
        *  Verifies that {@link #collection} and {@link #confirmed} have 
  @@ -1301,7 +1309,9 @@
               ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
               Object dest = in.readObject();
               in.close();
  -            assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj,
dest);
  +            if (isEqualsCheckable()) {
  +                assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj,
dest);
  +            }
           }
           obj = makeFullCollection();
           if (obj instanceof Serializable) {
  @@ -1313,7 +1323,10 @@
               ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
               Object dest = in.readObject();
               in.close();
  -            assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj, dest);
  +            if (isEqualsCheckable()) {
  +                assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj,
dest);
  +            }
           }
       }
  +    
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message