@Test public void testEnums() throws Exception { Basics obj = new Basics(123); out.writeObject(obj); in.resetForReuseUseArray(out.getCopyOfWrittenBuffer()); out.flush(); Basics res = (Basics) in.readObject(); // note: fix false alarm with 1.7_71 + newer 1.8. (because stacktrace not serialized ofc) Object[] exceptions1 = res.exceptions; Object[] exceptions2 = obj.exceptions; res.exceptions = obj.exceptions = null; for (int i = 1; i < exceptions1.length; i++) { assertTrue(exceptions1[i].getClass() == exceptions2[i].getClass()); } assertTrue(DeepEquals.deepEquals(obj, res)); }