Using rest-assured to invoke a base rest service with:
given().get(baseUrl + "/base/")
.then()
.statusCode(200)
.body("size()", is(2))
.body("meanPerDay", equalTo(1.5))
returns :
java.lang.AssertionError: 1 expectation failed.
JSON path meanPerDay doesn't match.
Expected: <1.5>
Actual: 1.5
The payload of baseUrl + "/base/"
is:
{
"meanPerDay": 1.5,
"stdPerDay": 0.5
}
If I replace .body("meanPerDay", equalTo(1.5)) with .body("meanPerDay", equalTo("1.5"))
the failure is:
java.lang.AssertionError: 1 expectation failed.
JSON path meanPerDay doesn't match.
Expected: 1.5
Actual: 1.5
I'm not accessing the meanPerDay
attribute correctly?
The test is finding the attribute value as the Expected
is value 1.5?