[EMAIL PROTECTED] wrote:

mcconnell 2003/07/11 07:58:06

Added: meta/api/src/test/org/apache/avalon/meta/info/test
InfoDescriptorTestCase.java
Log:
InfoDescriptor test-case addition.

<snip/>


Just so you know, the AbstractDescriptorTestCase takse care of testing
serialization, so in your derived test cases, you only have to worry about
testing additional features of the particular descriptor type.

public void testSerialization() throws IOException, ClassNotFoundException
{
File file = new File("name.test");
InfoDescriptor original = (InfoDescriptor) getDescriptor();
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
oos.writeObject(original);
oos.close();
ObjectInputStream ois = new ObjectInputStream( new FileInputStream(file));
InfoDescriptor serialized = (InfoDescriptor)ois.readObject();
ois.close();
file.delete();
checkDescriptor( serialized );
assertEquals( original, serialized );
assertEquals( original.hashCode(), serialized.hashCode() );
}
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to