I am testing endpoint with path para and query para and updating the request with some parameters. When I send the request content type is json and request looks good with the data that i am trying to change however when response is received
content type is text and i get 400 error bad request as status code and error message
javax.ws.rs.ProcessingException: RESTEASY008200: JSON Binding deserialization error: javax.json.bind.JsonbException: Can't infer a type for unmarshalling into: java.util.List
my code
@Given("^api is set up with required details$")
public void api_is_set_up_with_user_data() throws Throwable {
loadProp();
base_url = prop.getProperty("baseurl");
RestAssured.baseURI = base_url;
}
@When("^a user retrieves the preferences by userid \"([^\"]*)\" and type \"([^\"]*)\"$")
public void a_user_retrieves_the_preferences_by_userid_and_type(String userid, String parameter) throws Throwable {
request = given().pathParam("user_id", userid).queryParam("type", parameter);
System.out.println(request);
ENDPOINT_GET_USER_BY_ID = base_url + "{user_id}/preferences";
response = request.when().get(ENDPOINT_GET_USER_BY_ID);
System.out.println("response: " + response.prettyPrint());
}
@Then("^updates the value \"([^\"]*)\" of name \"([^\"]*)\"$")
public void updates_the_value_of_name(String value, String displaytext) throws Throwable {
HashMap<String,String> post = new HashMap<String,String>();
post.put("displaytext",displaytext);
post.put("value",value);
response = request.contentType("application/json").accept("*/*").body(post).put(ENDPOINT_GET_USER_BY_ID);
// response = request.header("Content-Type", "application/json").body(post).put(ENDPOINT_GET_USER_BY_ID);
System.out.println("Response : " + response.asString());
System.out.println("Statuscode : " +response.getStatusCode());
}