public void efetuouUmGET() throws Throwable {
RestAssured.baseURI = "https://jsonplaceholder.typicode.com";
JsonPath path = given()
.header("Accept", "application/json")
.parameter("id", 3)
.get("/albums")
.andReturn()
.jsonPath();
Albums posts = path.getObject("title", Albums.class);
Albums esperado1 = new Albums(1, 3, "omnis laborum odio");
Assert.assertEquals(esperado1, posts);
Alguem sabe o que eu fiz de errado? Preciso de uma ajudinha por favor.
MSG de erro
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of definitions.Albums out of START_ARRAY token
at [Source: ["omnis laborum odio"]; line: 1, column: 1]
atcom.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
atcom.fasterxml.jackson.databind.DeserializationContext.reportMappingException(DeserializationContext.java:1234)
atcom.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1122)
atcom.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1075)
atcom.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1370)
atcom.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:174)
atcom.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:150)
atcom.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)
atcom.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2880)
atcom.fasterxml.jackson.databind.ObjectMapper$readValue$0.call(Unknown Source)
atorg.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
atcom.jayway.restassured.internal.path.json.mapping.JsonPathJackson2ObjectDeserializer.deserialize(JsonPathJackson2ObjectDeserializer.groovy:43)
atcom.jayway.restassured.path.json.mapping.JsonPathObjectDeserializer$deserialize.call(Unknown Source)
atorg.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
atcom.jayway.restassured.internal.path.json.mapping.JsonObjectDeserializer.deserializeWithJackson2(JsonObjectDeserializer.groovy:98)
atcom.jayway.restassured.internal.path.json.mapping.JsonObjectDeserializer$deserializeWithJackson2.callStatic(Unknown Source)
atorg.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
atorg.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:214)
atcom.jayway.restassured.internal.path.json.mapping.JsonObjectDeserializer.deserialize(JsonObjectDeserializer.groovy:67)
atcom.jayway.restassured.path.json.JsonPath.getObject(JsonPath.java:556)