I am using assertJsonEquals of JsonUnit
I do the following in my code:
assertJsonEquals(resource("ExpecedResponse.json"),
ActualResponse, when(IGNORING_ARRAY_ORDER));
The ActualResponse
has the response from a HTTP POST.
The ExpectedResponse.json
is a json file with some fields as follows for e.g:
{
"columnNames": [
"date",
"signalType",
"userId",
],
"values": [
[
222555888,
"OUT",
"000-000-111-444"
],
[
333666999,
"IN",
"000-000-222-333"
],
],
"lastUpdatedTimestamp": "2018-01-26T00:00:00Z"
}
I compare the two responses with assertJsonEquals.
My question is: How do I tell it to ignore checking the lastUpdatedTimestamp
field but check everything else with assertJsonEquals or any other library that you can recommend?!
If I remove the lastUpdatedTimestamp from ExpectedResponse.json, then it complains that it is missing!
Would appreciate your help, thanks.