org.springframework.boot.test.json.BasicJsonTester Java Examples

The following examples show how to use org.springframework.boot.test.json.BasicJsonTester. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestApiApplicationTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Test
public void testCmmnRestApiIntegrationNotFound() {
    String processDefinitionsUrl = "http://localhost:" + serverPort + "/cmmn-api/cmmn-repository/case-definitions/does-not-exist";

    ResponseEntity<String> response = restTemplate.getForEntity(processDefinitionsUrl, String.class);

    BasicJsonTester jsonTester = new BasicJsonTester(getClass());

    assertThat(jsonTester.from(response.getBody())).isEqualToJson("{"
        + "\"message\": \"Not found\","
        + "\"exception\": \"no deployed case definition found with id 'does-not-exist'\""
        + "}");
    assertThat(response.getStatusCode())
        .as("Status code")
        .isEqualTo(HttpStatus.NOT_FOUND);
}
 
Example #2
Source File: RestApiApplicationTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Test
public void testExternalJobRestApiIntegrationNotFound() {
    String url = "http://localhost:" + serverPort + "/external-job-api/jobs/does-not-exist";

    ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);

    BasicJsonTester jsonTester = new BasicJsonTester(getClass());

    assertThat(jsonTester.from(response.getBody())).isEqualToJson("{"
            + "\"message\": \"Not found\","
            + "\"exception\": \"Could not find external worker job with id 'does-not-exist'.\""
            + "}");
    assertThat(response.getStatusCode())
            .as("Status code")
            .isEqualTo(HttpStatus.NOT_FOUND);
}