### Question:
EventMessage implements Serializable { public final Serializable getSerializableKey() { return key; } EventMessage(Ehcache cache, Serializable key); final Ehcache getEhcache(); final Serializable getSerializableKey();  }### Answer:
@Test public void testSerialization() throws IOException, ClassNotFoundException { RmiEventMessage eventMessage = new RmiEventMessage(null, RmiEventType.PUT, "key", new Element("key", "element")); ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bout); oos.writeObject(eventMessage); byte[] serializedValue = bout.toByteArray(); oos.close(); RmiEventMessage eventMessage2 = null; ByteArrayInputStream bin = new ByteArrayInputStream(serializedValue); ObjectInputStream ois = new ObjectInputStream(bin); eventMessage2 = (RmiEventMessage) ois.readObject(); ois.close(); assertEquals("key", eventMessage2.getSerializableKey()); assertEquals("element", eventMessage2.getElement().getObjectValue()); assertEquals(RmiEventType.PUT, eventMessage2.getType()); }