@Test public void findDiff() throws Exception { EsInstance es1 = new EsInstance(); EsInstance es2 = new EsInstance(); Assert.assertEquals(0, JsonCompareUtil.findDiff(es1, es2).size()); es1.setId("abc"); es2.setId("def"); Assert.assertEquals(1, JsonCompareUtil.findDiff(es1, es2).size()); DateTime now = DateTime.now(); es1.setCreatedTime(now.toDate()); es2.setCreatedTime(now.toDate()); Assert.assertEquals(1, JsonCompareUtil.findDiff(es1, es2).size()); es2.setCreatedTime(now.minus(1).toDate()); Assert.assertEquals(2, JsonCompareUtil.findDiff(es1, es2).size()); es1.setSecurityGroups(Arrays.asList("abc")); Assert.assertEquals(3, JsonCompareUtil.findDiff(es1, es2).size()); es2.setSecurityGroups(Arrays.asList("abc")); Assert.assertEquals(2, JsonCompareUtil.findDiff(es1, es2).size()); es2.setSecurityGroups(Arrays.asList("abc", "def")); Assert.assertEquals(3, JsonCompareUtil.findDiff(es1, es2).size()); es1.setCloud(new HashMap<String, Object>()); es1.getCloud().put("a", new HashMap<String, Object>()); ((HashMap<String, Object>) es1.getCloud().get("a")).put("b", Arrays.asList("c")); Assert.assertEquals(4, JsonCompareUtil.findDiff(es1, es2).size()); es2.setCloud(new HashMap<String, Object>()); es2.getCloud().put("a", new HashMap<String, Object>()); ((HashMap<String, Object>) es2.getCloud().get("a")).put("b", Arrays.asList("c")); Assert.assertEquals(3, JsonCompareUtil.findDiff(es1, es2).size()); ((HashMap<String, Object>) es1.getCloud().get("a")).put("b", "d"); Assert.assertEquals(4, JsonCompareUtil.findDiff(es1, es2).size()); es1.getCloud().put("array", new String[]{"a"}); es2.getCloud().put("array", new String[]{"a"}); Assert.assertEquals(4, JsonCompareUtil.findDiff(es1, es2).size()); }
public static <E> Map<String, Object[]> findDiff(E inst1, E inst2) throws Exception { return JsonCompareUtil.findDiff(inst1, inst2, new HashSet<String>()); }
JsonCompareUtil { public static <E> Map<String, Object[]> findDiff(E inst1, E inst2) throws Exception { return JsonCompareUtil.findDiff(inst1, inst2, new HashSet<String>()); } }
JsonCompareUtil { public static <E> Map<String, Object[]> findDiff(E inst1, E inst2) throws Exception { return JsonCompareUtil.findDiff(inst1, inst2, new HashSet<String>()); }  }
JsonCompareUtil { public static <E> Map<String, Object[]> findDiff(E inst1, E inst2) throws Exception { return JsonCompareUtil.findDiff(inst1, inst2, new HashSet<String>()); }  static Map<String, Object[]> findDiff(E inst1, E inst2); static Map<String, Object[]> findDiff(E inst1, E inst2, Set<String> excludedFields); static void getDetailsDiff(Map left, Map right, Map<String, Object[]> diffs,
                                    String prefix); }
JsonCompareUtil { public static <E> Map<String, Object[]> findDiff(E inst1, E inst2) throws Exception { return JsonCompareUtil.findDiff(inst1, inst2, new HashSet<String>()); }  static Map<String, Object[]> findDiff(E inst1, E inst2); static Map<String, Object[]> findDiff(E inst1, E inst2, Set<String> excludedFields); static void getDetailsDiff(Map left, Map right, Map<String, Object[]> diffs,
                                    String prefix); static final Logger logger; static final ObjectMapper DumpMapper; }