I need to do simple test using REST-assured. This is the link to google maps API http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway+Mountain+View+CA&sensor=false
and i need to verify that statusCode for that request is correct (200) and fields: status: "OK" type is "street_address" country is "US"
I wrote this code but it is partly working
public class RestTest {
@Test
public void Test1() {
RestAssured.get("http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway+Mountain+View+CA&sensor=false").then().
statusCode(200).
contentType(ContentType.JSON).
body("status", equalTo("OK")).
body("results.types", equalTo("street_address")).
body("results.address_components.short_name", equalTo("US"));
Check status code, content type and first part of body (status=OK) works well and pass the test but i had problems with last two body tests, they're failing and i get:
JSON path results.types doesn't match.
Expected: street_address
Actual: [[street_address]]