movieA.writeExternal(out);
movieA2.writeExternal(out);
movieB.writeExternal(out);
out.close();
final ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
final Movie readMovie = new Movie();
readMovie.readExternal(in);
assertEquals(movieDefault, readMovie);
readMovie.readExternal(in);
assertEquals(movieA, readMovie);
readMovie.readExternal(in);
assertEquals(movieA2, readMovie);
readMovie.readExternal(in);
assertEquals(movieB, readMovie);
} catch (IOException e) {
fail(e.toString());
}
}