Skip to content

Commit

Permalink
Test for similar consecutive array elements failing. Relates to #13
Browse files Browse the repository at this point in the history
  • Loading branch information
algesten committed Nov 18, 2012
1 parent 18bdeae commit 3df3d17
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/java/foodev/jsondiff/JsonDiffTest.java
Expand Up @@ -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);

}

}

0 comments on commit 3df3d17

Please sign in to comment.