Timeline for Avoiding a NPE when checking JSON response using JsonPath and Rest Assured
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 20, 2021 at 11:41 | comment | added | Steerpike | thank you for your help; appreciated | |
Apr 20, 2021 at 11:41 | vote | accept | Steerpike | ||
Apr 20, 2021 at 11:20 | comment | added | PDHide | @Steerpike is updated answer | |
Apr 20, 2021 at 11:19 | history | edited | PDHide | CC BY-SA 4.0 |
deleted 4 characters in body
|
Apr 20, 2021 at 11:03 | comment | added | Steerpike |
apologies, I probably wasn't clear. I want to perform conditional logic IF a value is null. So, I want to send a new Update RQ if any of the key values are null e.g. if "priceTwo": null
|
|
Apr 20, 2021 at 11:00 | comment | added | PDHide | @Steerpike use jsonObj.isNull("species") then , i thought you want to validate whether key exists or not | |
Apr 20, 2021 at 10:42 | comment | added | Steerpike |
thanks for the answer - this looks the neatest solution yet the jsonObj.has always evaluates to true, because priceTwo key always exists, regardless of whether value is null, so the l/h side of ? always gets run with the result: org.json.JSONObject$Null cannot be cast to java.lang.Integer java.lang.ClassCastException: org.json.JSONObject$Null cannot be cast to java.lang.Integer
|
|
Apr 20, 2021 at 8:42 | vote | accept | Steerpike | ||
Apr 20, 2021 at 10:28 | |||||
Apr 19, 2021 at 7:33 | history | edited | PDHide | CC BY-SA 4.0 |
added 4 characters in body
|
Apr 19, 2021 at 7:27 | history | answered | PDHide | CC BY-SA 4.0 |