_ivanovich_
5 years agoFrequent Contributor
Assertion using groovy sometimes throws java.lang,NullPointerException
Hi,
when i try to assert a group assertion like:
assert slurperresponse.values.data.name.person== true assert slurperresponse.values.data.address.person== true assert slurperresponse.values.data.car.person== true assert slurperresponse.values.data.city.person== true assert slurperresponse.values.data.country.person== true assert slurperresponse.values.data.province.person== true assert slurperresponse.values.data.code.person== true assert slurperresponse.values.data.group.person== true
It works for sometime.
After sometime it throws java.lang.NullPointerException saying java.lang.NullPointerException:Cannot get person on null object.
If i remove the last assertion it works again.
i tried this:
if(slurperresponse.values.data.group.person != null){
assert slurperresponse.values.data.group.person== true
}
i got the same error.
If i wait for sometime then it works.
Is there a probleme with memory leak or garbage collection .
Did someone notice this behavior ?
Or is there a better way to reduce all lines?
Thank you