public static void assertSerializationEquals(final String witness,final Object obj,final int[] skip,final int endCompare) throws Exception {
  ByteArrayOutputStream memOut=new ByteArrayOutputStream();
  ObjectOutputStream objOut=new ObjectOutputStream(memOut);
  objOut.writeObject(obj);
  objOut.close();
  assertStreamEquals(witness,memOut.toByteArray(),skip,endCompare);
}

public static void assertSerializationEquals ( final String witness , final Object obj , final int [ ] skip , final int endCompare ) throws Exception { ByteArrayOutputStream memOut = new ByteArrayOutputStream ( ) ; ObjectOutputStream objOut = new ObjectOutputStream ( memOut ) ; objOut . writeObject ( obj ) ; objOut . close ( ) ; assertStreamEquals ( witness , memOut . toByteArray ( ) , skip , endCompare ) ; }
checks the serialization of an object against an file containing the expected serialization .
