The 'if' condition in karate to match two json strings is not returning the correct result.
I tried matching two jsons both with same structure as below in an if condition, and wanted to call a java method if the test condition fails:
{
"propertySources":[
{
"source": {....},
"source": {....},
"source": {....},
"source": {....}
}
]
}
Given ...
When ...
Then ...
**And if(propertySources[0].source!=propertySources[0].source) <javaMethodName>**
I am expecting the java method to be called only when the jsons do not match, but they are getting called all the time even if they are identical. This assertion works for simple numbers like (1 != 2) but fails for the json strings.
I have tried calling another feature file in place of the java method, and it is still the same. Could you help with this please?
Given ...
When ...
Then ...
**And if(propertySources[0].source != propertySources[0].source) karate.call(featureName)**