Open
Description
We'd like to have an ability to provide more verbose, or generally custom json diff view on assertion error (such like un*x diff -y
does).
For example, given two jsons:
{
"id": "101",
"key": {
"a": "value",
"b": "xyz",
"c": 201
}
}
and:
{
"id": "102",
"key": {
"a": "value",
"d": [1, 2]
}
}
calling:
DiffViewProvider diffViewProvider = new LinuxAlikeDiffViewProvider();
JSONAssert.assertEquals(json1, json2, true, diffViewProvider);
would throw an AssertionError with original message and additionally (optionally) more verbose diff:
java.lang.AssertionError: id
Expected: 101
got: 102
; key
Expected: b
but none found
; key
Expected: c
but none found
; key
Unexpected: d
Actual json vs expected json:
{ {
"id": "101", | "id": "102",
"key": { "key": {
"a": "value", "a": "value",
"b": "xyz", | "d": [1, 2]
"c": 201 <
} }
} }
More json-conscious diff:
{ {
"id": "101", | "id": "102",
"key": { "key": {
"a": "value", "a": "value",
"b": "xyz", <
"c": 201 <
> "d": [1, 2]
} }
} }
Metadata
Metadata
Assignees
Labels
No labels