@SuppressWarnings("unchecked") @Test void nominalSchemaDeepCopyShouldSucceed() { LinkedHashMap<String, Object> originalLinkedHashMap = new LinkedHashMap<>(); ArrayList<Integer> originalArrayList = new ArrayList<>(Arrays.asList(new Integer(10))); originalLinkedHashMap.put("boolean", new Boolean(true)); originalLinkedHashMap.put("string", "original"); originalLinkedHashMap.put("list", originalArrayList); originalLinkedHashMap.put("null", null); Object copiedLinkedHashMapObject = DeepCopySubstitution.simpleDeepCopy(originalLinkedHashMap); assertTrue(copiedLinkedHashMapObject instanceof LinkedHashMap); LinkedHashMap<String, Object> copiedLinkHashMap = (LinkedHashMap<String, Object>) copiedLinkedHashMapObject; Object copiedArrayListObject = copiedLinkHashMap.get("list"); assertTrue(copiedArrayListObject instanceof ArrayList); ArrayList<Integer> copiedArrayList = (ArrayList<Integer>) copiedArrayListObject; assertTrue(Objects.deepEquals(originalLinkedHashMap, copiedLinkHashMap)); assertNotSame(originalLinkedHashMap, copiedLinkHashMap); assertNotSame(originalLinkedHashMap.get("boolean"), copiedLinkHashMap.get("boolean")); assertNotSame(originalLinkedHashMap.get("string"), copiedLinkHashMap.get("string")); assertNotSame(originalArrayList, copiedArrayList); assertNotSame(originalArrayList.get(0), copiedArrayList.get(0)); assertNull(copiedLinkHashMap.get("null")); }
@Substitute public static Object simpleDeepCopy(Object toCopy) { return JsonUtils.cloneJson(toCopy); }
DeepCopySubstitution { @Substitute public static Object simpleDeepCopy(Object toCopy) { return JsonUtils.cloneJson(toCopy); } }
DeepCopySubstitution { @Substitute public static Object simpleDeepCopy(Object toCopy) { return JsonUtils.cloneJson(toCopy); }  }
DeepCopySubstitution { @Substitute public static Object simpleDeepCopy(Object toCopy) { return JsonUtils.cloneJson(toCopy); }  @Substitute static Object simpleDeepCopy(Object toCopy); }
DeepCopySubstitution { @Substitute public static Object simpleDeepCopy(Object toCopy) { return JsonUtils.cloneJson(toCopy); }  @Substitute static Object simpleDeepCopy(Object toCopy);  }