RESOStandards / web-api-commander

Client tools and libraries to work with and test RESO Web APIs.
https://commander.reso.org
Other
37 stars 18 forks source link

Web API Server Core Endorsement - DecimalValue test fails with NullPointerException #156

Open jeremiethibeault-centris opened 1 year ago

jeremiethibeault-centris commented 1 year ago

We're having a NullPointerException when executing the commander using our Web API RESO script file.

java.lang.AssertionError: ERROR: java.lang.NullPointerException
    at org.junit.Assert.fail(Assert.java:89)
    at org.reso.certification.stepdefs.WebAPIServerCore.lambda$new$19(WebAPIServerCore.java:445)
    at ?.Decimal data in "Parameter_DecimalField" "ne" "Parameter_DecimalValueLow"(file:///D:/a/r1/a/web-api-commander/src/main/java/org/reso/certification/features/web-api/web-api-server.core.feature:222)

The commander validates that the Web API supports filtering using decimal values using the following requests.

<Request
    RequestId="filter-decimal-eq"
    OutputFile="filter-decimal-eq.json"
    Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_KeyField*,*Parameter_DecimalField*&amp;$filter=*Parameter_DecimalField* eq *Parameter_DecimalValueLow*"
/>

...

<Request
    RequestId="filter-decimal-le"
    OutputFile="filter-decimal-le.json"
    Url="*ClientSettings_WebAPIURI*/*Parameter_EndpointResource*?$top=*Parameter_TopCount*&amp;$select=*Parameter_KeyField*,*Parameter_DecimalField*&amp;$filter=*Parameter_DecimalField* le *Parameter_DecimalValueHigh*"
/>

This is working fine except when one or multiple decimal values returned are null which is a valid result based on the given filter. In our case, there are no required decimal fields.

We can play around with the configurable sample values but in any case there could be null values returned in one of the eq or ne tests. This is not a problem for the gt, lt as null is filtered out.

<Parameter Name="DecimalValueLow" Value="1.00"/>
<Parameter Name="DecimalValueHigh" Value="1234567.89"/>