Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test for similar consecutive array elements failing. Relates to #13

  • Loading branch information...
commit 3df3d17bfae37e3254827df9858c4b2775bc1b57 1 parent 18bdeae
@algesten authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/test/java/foodev/jsondiff/JsonDiffTest.java
View
18 src/test/java/foodev/jsondiff/JsonDiffTest.java
@@ -823,5 +823,23 @@ public void testAdjustArrayMutationNestedArrayToObject() {
Assert.assertEquals(to, p);
}
+
+ // Issue #13. Thanks to Daniel Gardner for reporting.
+ @Test
+ public void testSameEndValueTwoConsequtiveArrayElements() {
+
+ String i = "{\"a\":[{\"b\":[1],\"c\":\"x\"}]}";
+
+ String j1 = "{\"a\":[{\"b\":[1],\"c\":\"x\"},{\"b\":[1],\"c\":\"x\"}]}";
+
+ String d = JsonDiff.diff(i, j1);
+
+ Assert.assertEquals("{\"a[+1]\":{\"b\":[1],\"c\":\"x\"}}", d);
+
+ String p = JsonPatch.apply(i, d);
+
+ Assert.assertEquals(j1, p);
+
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.