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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to