I am trying to create stub through java code but fails with http 422 error, where as when I try same from postman getting success 201 created.
String mapping =
"{" //@formatter:off
+ "\"priority\": 1,"
+ "\"request\": {"
+ "\"urlPath\": \"/api/v1/organizations/685110093313737070/admins\","
+ "\"method\": \"GET\""
+ "},"
+ "\"response\": {"
+ "\"status\": 200,"
+ "\"jsonBody\": {"
+ "\"id\": \"85110093313760778\","
+ "\"name\": \"name\","
+ "}"; // @formatter:on
addMappingToStub(mapping);
}
private static void addMappingToStub(String mapping) {
RestAssured.given()
.header("Content-Type", "application/json")
.body(mapping)
.then()
.assertThat()
.statusCode(HttpStatus.SC_CREATED);
}