FieldMapper { public static <T> T mapFields(T source, T destination) { FieldMap sourceMap = getFieldMap(source.getClass()); destination = mapFields(sourceMap, source, destination); return destination; } private  FieldMapper(@NotNull Class clazz); static T mapFields(T source, T destination); static FieldMap getFieldMap(@NotNull Class clazz); @Override String toString();  }
@Test public void testMapFields() { Comprehensive expected = new Comprehensive(); expected.aInt = 125612; expected.custom.name = "asdhhojao"; expected.simpleList.add(new Simple("asdfaghrhah")); expected.custom2 = new Custom("135r3trgah"); Comprehensive actual = new Comprehensive(); assertFalse(expected.equals(actual)); FieldMapper.mapFields(expected, actual); assertEquals(expected, actual); }