Search in sources :

Example 11 with Errors

use of com.github.tomakehurst.wiremock.common.Errors in project wiremock by wiremock.

the class AdminApiTest method returnsBadEntityStatusWhenMatchesOperandIsWrongType.

@Test
public void returnsBadEntityStatusWhenMatchesOperandIsWrongType() {
    WireMockResponse response = testClient.postJson("/__admin/mappings", "{\n" + "    \"request\": {\n" + "        \"bodyPatterns\": [\n" + "            {\n" + "                \"matches\": 12\n" + "            }\n" + "        ]\n" + "    }\n" + "}");
    assertThat(response.statusCode(), is(422));
    Errors errors = Json.read(response.content(), Errors.class);
    assertThat(errors.first().getSource().getPointer(), is("/request/bodyPatterns/0"));
    assertThat(errors.first().getTitle(), is("Error parsing JSON"));
    assertThat(errors.first().getDetail(), is("matches operand must be a non-null string"));
}
Also used : WireMockResponse(com.github.tomakehurst.wiremock.testsupport.WireMockResponse) Errors(com.github.tomakehurst.wiremock.common.Errors) Test(org.junit.jupiter.api.Test)

Aggregations

Errors (com.github.tomakehurst.wiremock.common.Errors)11 WireMockResponse (com.github.tomakehurst.wiremock.testsupport.WireMockResponse)11 Test (org.junit.jupiter.api.Test)11