@Test public void testObjectArrayDiff_addRemove_wid() throws Exception { JsonCompare cmp = new JsonCompare(); cmp.addArrayIdentity(new Path("d"), new Path("id")); JsonNode doc1 = json("{'a':1,'b':'y','c':true,'d':[ {'id':1,'q':'1','w':'2'}, {'id':2,'q':'3','w':'4'},{'id':3,'q':'5','w':'6'}]}"); JsonNode doc2 = json("{'b':'y','a':1,'c':true,'d':[ {'id':1,'q':'1','w':'22'}, {'id':2,'q':'3','w':'4'},{'id':3,'q':'7','w':'8'}]}"); JsonCompare.Difference diff = cmp.compareNodes(doc1, doc2); System.out.println(diff); Assert.assertFalse(diff.same()); Assert.assertEquals(3, diff.getDelta().size()); Assert.assertTrue(hasDelta(diff.getDelta(), JsonCompare.Modification.class, null, "d.0.w")); Assert.assertTrue(hasDelta(diff.getDelta(), JsonCompare.Modification.class, null, "d.2.q")); Assert.assertTrue(hasDelta(diff.getDelta(), JsonCompare.Modification.class, null, "d.2.w")); }
@Override protected int size(ArrayNode value) { return value.size(); }
JsonCompare extends DocComparator<JsonNode, ValueNode, ObjectNode, ArrayNode> { @Override protected int size(ArrayNode value) { return value.size(); } }
JsonCompare extends DocComparator<JsonNode, ValueNode, ObjectNode, ArrayNode> { @Override protected int size(ArrayNode value) { return value.size(); }  }
JsonCompare extends DocComparator<JsonNode, ValueNode, ObjectNode, ArrayNode> { @Override protected int size(ArrayNode value) { return value.size(); }  static void main(String[] args); }
JsonCompare extends DocComparator<JsonNode, ValueNode, ObjectNode, ArrayNode> { @Override protected int size(ArrayNode value) { return value.size(); }  static void main(String[] args);  }