ObjectUtil { public static <T> List<T> deepCopyList(List<T> arg) { if (arg == null) { return null; } List<T> retList = new ArrayList<T>(); for (T each : arg) { retList.add(deepCopy(each)); } return retList; } private  ObjectUtil(); @SuppressWarnings("unchecked") static T deepCopy(T obj); static List<T> deepCopyList(List<T> arg);  }
@Test public void deepCopyList_A$List_List() throws Exception { List<Object> arg = new ArrayList<Object>(); arg.add(new Object()); arg.add(new Object()); List<Object> result = ObjectUtil.deepCopyList(arg); assertNotSame(result, arg); assertNotSame(result.get(0), arg.get(0)); assertNotSame(result.get(0), arg.get(0)); }
@Test public void deepCopyList_A$List_empty() throws Exception { List<Object> arg = new ArrayList<Object>(); List<Object> result = ObjectUtil.deepCopyList(arg); assertNotSame(result, arg); }
@Test public void deepCopyList_A$List_null() throws Exception { List<Object> arg = null; List<Object> result = ObjectUtil.deepCopyList(arg); assertSame(result, arg); }