I'm doing comparison of values in Oracle database on one end and the service at the other. There are attributes which return NULL value and those same attributes are not found in the service response when this is the case.
I need an assertion in the REST request that will pass this scenario, but the regular assertions do not work. When I try to assert these, I get the following error:
Comparison failed. Path:
Expected value: ;
Actual value: .
Expected value is the attribute from the JDBC Request and the Actual value is the corresponding attribute from the REST request. As you can see, the responses are the same, but the assertion does not pass. Is there a way to bypass this? Thanks.
EDIT: I know this can be done with a Groovy script, but I would really prefer a solution with assertions inside the REST request.
Thing is, I cannot be certain that the response will be returned NULL and when it's a non-NULL value, I need the assertion, so I need one that would cover both cases.
Unfortunately, I cannot share the response cause of the NDA, but here's an example of what it might look like:
"attribute" : someValue
And the SQL query 'select attribute from table' returns the value 'someValue'.
Now let's say that the attribute from the SQL query returns '(null)', in that case the 'list' node would not contain the 'attribute' element.
Funny thing is that when you reference a non-existing element in the REST request, it returns an empty string, which should be perfect and it's the same when you reference a NULL value in the JDBC request, but they just won't match for some reason.