MetaClone { public static <T extends Serializable> T clone(T obj){ try { return SerializationUtils.clone(obj); }catch (SerializationException e){ logger.error("[clone]", e); throw e; } }  static T clone(T obj);  }
@Test public void testClone() { XpipeMeta xpipeMeta = getXpipeMeta(); DcMeta dcMeta = xpipeMeta.getDcs().values().iterator().next(); DcMeta clone = MetaClone.clone(dcMeta); Assert.assertEquals(dcMeta, clone); clone.setId(randomString()); Assert.assertNotEquals(dcMeta, clone); }
@Test public void testCloneMultiTimes() { int count = 1 << 1; XpipeMeta xpipeMeta = getXpipeMeta(); DcMeta dcMeta = xpipeMeta.getDcs().values().iterator().next(); DcMeta clone = null; for (int i = 0; i < count; i++) { clone = MetaClone.clone(dcMeta); } }