@Test public void copyData() { SanskritObjectImpl subObject = new SanskritObjectImpl(objectMapperSupplier); subObject.setString("1", "b"); SanskritObjectImpl object = new SanskritObjectImpl(objectMapperSupplier); object.setString("1", "a"); object.setLong("2", 1L); object.setObject("3", subObject); SanskritObject sanskritObject = CopyUtils.makeCopy(objectMapperSupplier, object); sanskritObject.accept(visitor1); sanskritObject.getObject("3").accept(visitor2); verify(visitor1).setString("1", "a"); verify(visitor1).setLong("2", 1L); verify(visitor2).setString("1", "b"); }
static SanskritObjectImpl makeCopy(ObjectMapperSupplier objectMapperSupplier, SanskritObject object) { if (object == null) { return null; } SanskritObjectImpl copy = new SanskritObjectImpl(objectMapperSupplier); object.accept(copy); return copy; }
CopyUtils { static SanskritObjectImpl makeCopy(ObjectMapperSupplier objectMapperSupplier, SanskritObject object) { if (object == null) { return null; } SanskritObjectImpl copy = new SanskritObjectImpl(objectMapperSupplier); object.accept(copy); return copy; } }
CopyUtils { static SanskritObjectImpl makeCopy(ObjectMapperSupplier objectMapperSupplier, SanskritObject object) { if (object == null) { return null; } SanskritObjectImpl copy = new SanskritObjectImpl(objectMapperSupplier); object.accept(copy); return copy; }  }
CopyUtils { static SanskritObjectImpl makeCopy(ObjectMapperSupplier objectMapperSupplier, SanskritObject object) { if (object == null) { return null; } SanskritObjectImpl copy = new SanskritObjectImpl(objectMapperSupplier); object.accept(copy); return copy; }   }
CopyUtils { static SanskritObjectImpl makeCopy(ObjectMapperSupplier objectMapperSupplier, SanskritObject object) { if (object == null) { return null; } SanskritObjectImpl copy = new SanskritObjectImpl(objectMapperSupplier); object.accept(copy); return copy; }    }