EntityUtils { public static void copyProperties(Object from, Object to) throws Exception { copyPropertiesExclude(from, to, null); }  static void copyProperties(Object from, Object to); static void copyPropertiesExclude(Object from, Object to, String[] excludeArray); @SuppressWarnings("unchecked") static void copyPropertiesInclude(Object from, Object to, String[] includeArray);  }
@Test public void copyProperties() throws Exception { FromClassGetter fromClass = new FromClassGetter(); fromClass.setStringValue("[FromClass] = Save"); InnerClass innerClass = new InnerClass(); innerClass.setStringValue("[InnerClass] = Save"); fromClass.setInnerClass(innerClass); ToClassSetter toClass = new ToClassSetter(); EntityUtils.copyProperties(fromClass, toClass); assertEquals(fromClass.getStringValue(), toClass.getStringValue()); assertEquals(fromClass.getInnerClass(), toClass.getInnerClass()); }