use of com.github.sviperll.adt4j.examples.UserKey in project adt4j by sviperll.
the class MainTest method testSerialization.
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
UserKey userKey1 = UserKey.valueOf(1);
ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
ObjectOutputStream outputStream = new ObjectOutputStream(byteArray);
outputStream.writeObject(userKey1);
ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(byteArray.toByteArray()));
UserKey userKey2 = (UserKey) inputStream.readObject();
assertTrue("userKey1.equals(userKey2)", userKey1.equals(userKey2));
}
Aggregations