KryoSerializer implements PojoSerializer<O> { @SuppressWarnings("unchecked") public static <O> void validateObjectIsRoundTripSerializable(O candidatePojo) { Class<O> objectType = (Class<O>) candidatePojo.getClass(); KryoSerializer.validateObjectIsRoundTripSerializable(candidatePojo, objectType, PersistenceConfig.DEFAULT_CONFIG); } KryoSerializer(Class<O> objectType, PersistenceConfig persistenceConfig); @Override byte[] serialize(O object); @Override @SuppressWarnings("unchecked") O deserialize(byte[] bytes); @SuppressWarnings("unchecked") static void validateObjectIsRoundTripSerializable(O candidatePojo);  }
@Test public void testPositiveSerializability() { KryoSerializer.validateObjectIsRoundTripSerializable(new KryoSerializablePojo(1)); }
@Test(expected = IllegalStateException.class) public void testNegativeSerializability() { KryoSerializer.validateObjectIsRoundTripSerializable(new NonKryoSerializablePojo(1)); }
@Test(expected = IllegalStateException.class) public void testPolymorphicSerialization_WithNonPolymorphicConfig() { KryoSerializer.validateObjectIsRoundTripSerializable(1, Number.class, PersistenceConfig.DEFAULT_CONFIG); }
@Test public void testPolymorphicSerialization_WithPolymorphicConfig() { KryoSerializer.validateObjectIsRoundTripSerializable(1, Number.class, POLYMORPHIC_CONFIG); }