commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15127] New: - Tests should explicit about checking serialization
Date Fri, 06 Dec 2002 00:50:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15127>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15127

Tests should explicit about checking serialization

           Summary: Tests should explicit about checking serialization
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: rich@rd.gen.nz


I realise the tests don't form part of the public API for Collections,
however I find them very useful for testing my collection
implementations. You could consider this as a minor bug or an
enhancement request, depending on your perspective.

Tests for serialization should be independent of whether or not a
class implements Serializable. Some objects should be tested for
serializability even if they don't implement the interface (thus
indicating to the developer that they should do so), and others should
not be tested, even if they do implement it.

- Consider the list created by:

    List list1 = Collections.EMPTY_LIST
    List list2 = list1.subList(0, 0);
    List list3 = Collections.unmodifiableList(list2);

  list3 meets the spec for List, but it will not pass the
  serialization tests because list3 implements Serializable, but it
  wraps list2, which does not.

- Consider the list:

    class ShouldBeSerializableList implements List {
        ...
    }

  This list should be tested for serializability, even though it
  doesn't implement Serializable.

Perhaps TestObject has a method isSerializable() or
supportsSerialization() that indicates whether or not an object should
be tested for serializability. This could replace 'instanceof
Serializable' checks throughout the test suite. Subclasses override
supportsSerialization() to return false if they don't support
serialization.

TestList could also have a method
subListSupportsSerialization() which is called from BulkTestSubList's
supportsSerialization() method. TestMap chould have a method
entrySetSupportsSerialization(), etc.

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


Mime
View raw message