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

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

下面列出了org.springframework.boot.test.json.BasicJsonTester 类实例代码,或者点击链接到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);
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法