public void testEqualsAfterSerialization() throws IOException, ClassNotFoundException {
SystemHashCodeSimulatingKey sysKey = new SystemHashCodeSimulatingKey("test");
MultiKey mk = new MultiKey(ONE, sysKey);
Map map = new HashMap();
map.put(mk, TWO);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeObject(sysKey);
out.writeObject(map);
out.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream in = new ObjectInputStream(bais);
sysKey = (SystemHashCodeSimulatingKey) in.readObject();
Map map2 = (Map) in.readObject();
in.close();
assertEquals(2, sysKey.hashCode());
MultiKey mk2 = new MultiKey(ONE, sysKey);
assertEquals(TWO, map2.get(mk2));
}
}