harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Loenko" <mloe...@gmail.com>
Subject Re: How to deal with this kind of serialization compatibility issue?
Date Wed, 15 Mar 2006 10:57:08 GMT
Using serialization framework from security module,
the test would look like as follows:

public class CharacterCodingExceptionTest extends SerializationTest {

    protected Object[] getData() {
        return new Object[] { new CharacterCodingExceptionTest ()};
    }

    protected void assertDeserialized(Object oref, Object otest) {
        CharacterCodingExceptionTest ref = (CharacterCodingExceptionTest ) oref;
        CharacterCodingExceptionTest test =
(CharacterCodingExceptionTest ) otest;

        assertNull(test.getMessage());
    }
}

Thanks,
Mikhail

2006/3/15, Paulex Yang <paulex.yang@gmail.com>:
> Hi, Mikhail,
>
> Mikhail Loenko wrote:
> > Hi George!
> >
> >
> >> I need to study H-57 SerializationTester, likely it makes sense taking
> >> best ideas from both
> >>
> >
> > I was trying to find out how the framework works and how a test
> > based on that framework looks like.
> >
> > I've taken the first class refering to SerializationTester, it was
> > CharacterCodingExceptionTest
> >
> > it has two serialization related test methods:
> >     testSerialization()
> >     testSerializationCompatibility()
> >
> > They both call SerializationTester methods but I did not find that they check
> > that the objects are the same. Did I miss anything?
> >
> The CharacterCodingException don't necessary to be assertSame() for
> serialization test, because it has no predefined constants:).
>
> I think the classes commonly needs to override readResolve() method to
> implement predefined constants serialization properly, so that it is
> easy to find all the candidates from the JavaDoc page of serilization
> form. But, of course, readResolve() is not a suffient condition:(.
>
> > Thanks,
> > Mikhail
> >
> >
>
>
> --
> Paulex Yang
> China Software Development Lab
> IBM
>
>
>

Mime
View raw message