KryoCloneUtils { public T getClone() { try (Input input = new Input(bin)) { return kryo.readObject(input, clazz); } } @SuppressWarnings("unchecked") private  KryoCloneUtils(Kryo kryo, T t); T getClone(); @SuppressWarnings("unchecked") T[] getClones(int num); @SuppressWarnings("unchecked") static SRC cloneObject(Kryo kryo, SRC src); static SRC cloneObject(SRC src); static KryoCloneUtils<SRC> createCloneUtils(SRC template); static KryoCloneUtils<SRC> createCloneUtils(Kryo kryo, SRC template);  }
@Test public void testGetClone() throws Exception { TestEntity from = getTestEntity(5); KryoCloneUtils<TestEntity> cloneUtils = KryoCloneUtils.createCloneUtils(from); TestEntity to = cloneUtils.getClone(); assertFalse(from == to); assertEquals(from, to); assertFalse(from.transientProp.equals(to.transientProp)); }