类org.springframework.boot.test.json.BasicJsonTester源码实例Demo

下面列出了怎么用org.springframework.boot.test.json.BasicJsonTester的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: flowable-engine   文件: RestApiApplicationTest.java
@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);
}
 
源代码2 项目: flowable-engine   文件: RestApiApplicationTest.java
@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);
}
 
 类所在包
 类方法
 同包方法