本文整理了Java中io.restassured.path.json.JsonPath.getList()
方法的一些代码示例,展示了JsonPath.getList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonPath.getList()
方法的具体详情如下:
包路径:io.restassured.path.json.JsonPath
类名称:JsonPath
方法名:getList
[英]Get the result of an Object path expression as a list.
[中]以列表形式获取对象路径表达式的结果。
代码示例来源:origin: camunda/camunda-bpm-platform
private void verifyDeploymentLink(Deployment mockDeployment, String responseContent) {
List<Map<String, String>> returnedLinks = from(responseContent).getList("links");
assertEquals(1, returnedLinks.size());
Map<String, String> returnedLink = returnedLinks.get(0);
assertEquals(HttpMethod.GET, returnedLink.get("method"));
assertTrue(returnedLink.get("href").endsWith(RESOURCE_URL + "/" + mockDeployment.getId()));
assertEquals("self", returnedLink.get("rel"));
}
代码示例来源:origin: camunda/camunda-bpm-platform
private void verifyTaskCommentLink(Comment mockTaskComment, String responseContent) {
List<Map<String, String>> returnedLinks = from(responseContent).getList("links");
assertEquals(1, returnedLinks.size());
Map<String, String> returnedLink = returnedLinks.get(0);
assertEquals(HttpMethod.GET, returnedLink.get("method"));
assertTrue(returnedLink.get("href").endsWith(SINGLE_TASK_COMMENTS_URL.replace("{id}", mockTaskComment.getTaskId()) + "/" + mockTaskComment.getId()));
assertEquals("self", returnedLink.get("rel"));
}
代码示例来源:origin: camunda/camunda-bpm-platform
private void verifyTaskAttachmentLink(Attachment mockTaskAttachment, String responseContent) {
List<Map<String, String>> returnedLinks = from(responseContent).getList("links");
assertEquals(1, returnedLinks.size());
Map<String, String> returnedLink = returnedLinks.get(0);
assertEquals(HttpMethod.GET, returnedLink.get("method"));
assertTrue(returnedLink.get("href").endsWith(SINGLE_TASK_ATTACHMENTS_URL.replace("{id}", mockTaskAttachment.getTaskId()) + "/" + mockTaskAttachment.getId()));
assertEquals("self", returnedLink.get("rel"));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testCaseActivityIdListPostParameter() {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("caseActivityIdIn", MockProvider.EXAMPLE_CASE_ACTIVITY_ID_LIST.split(","));
Response response = given()
.contentType(POST_JSON_CONTENT_TYPE)
.body(queryParameters)
.expect()
.statusCode(Status.OK.getStatusCode())
.when()
.post(HISTORIC_CASE_INSTANCE_RESOURCE_URL);
verify(mockedQuery).caseActivityIdIn(MockProvider.EXAMPLE_CASE_ACTIVITY_ID, MockProvider.ANOTHER_EXAMPLE_CASE_ACTIVITY_ID);
verify(mockedQuery).list();
String content = response.asString();
List<String> historicCaseInstances = from(content).getList("");
assertThat(historicCaseInstances).hasSize(1);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testSimpleHistoricTaskInstanceQuery() {
Response response = given()
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(HISTORIC_TASK_INSTANCE_RESOURCE_URL);
InOrder inOrder = inOrder(mockedQuery);
inOrder.verify(mockedQuery).list();
String content = response.asString();
List<String> instances = from(content).getList("");
Assert.assertEquals("There should be one historic task instance returned.", 1, instances.size());
Assert.assertNotNull("The returned historic task instance should not be null.", instances.get(0));
verifyHistoricTaskInstanceEntries(content);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void tenantRetrieval() {
String name = MockProvider.EXAMPLE_TENANT_NAME;
Response response = given().queryParam("name", name)
.then().expect().statusCode(Status.OK.getStatusCode())
.when().get(QUERY_URL);
InOrder inOrder = inOrder(mockQuery);
inOrder.verify(mockQuery).tenantName(name);
inOrder.verify(mockQuery).list();
String content = response.asString();
List<String> instances = from(content).getList("");
assertThat(instances.size(), is(1));
String returnedId = from(content).getString("[0].id");
String returnedName = from(content).getString("[0].name");
assertThat(returnedId, is(MockProvider.EXAMPLE_TENANT_ID));
assertThat(returnedName, is(MockProvider.EXAMPLE_TENANT_NAME));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testSimpleHistoricTaskInstanceQueryAsPost() {
Response response = given()
.contentType(POST_JSON_CONTENT_TYPE)
.body(EMPTY_JSON_OBJECT)
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.when()
.post(HISTORIC_TASK_INSTANCE_RESOURCE_URL);
InOrder inOrder = inOrder(mockedQuery);
inOrder.verify(mockedQuery).list();
String content = response.asString();
List<String> instances = from(content).getList("");
Assert.assertEquals("There should be one historic task instance returned.", 1, instances.size());
Assert.assertNotNull("The returned historic task instance should not be null.", instances.get(0));
verifyHistoricTaskInstanceEntries(content);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testCaseActivityIdListParameter() {
Response response = given()
.queryParam("caseActivityIdIn", MockProvider.EXAMPLE_CASE_ACTIVITY_ID_LIST)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(HISTORIC_CASE_INSTANCE_RESOURCE_URL);
verify(mockedQuery).caseActivityIdIn(MockProvider.EXAMPLE_CASE_ACTIVITY_ID, MockProvider.ANOTHER_EXAMPLE_CASE_ACTIVITY_ID);
verify(mockedQuery).list();
String content = response.asString();
List<String> historicCaseInstances = from(content).getList("");
assertThat(historicCaseInstances).hasSize(1);
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected void verifyExampleUserResponse(Response response) {
String content = response.asString();
List<String> instances = from(content).getList("");
Assert.assertEquals("There should be one user returned.", 1, instances.size());
Assert.assertNotNull("The returned user should not be null.", instances.get(0));
String returendLastName = from(content).getString("[0].lastName");
String returnedFirstName = from(content).getString("[0].firstName");
String returnedEmail = from(content).getString("[0].email");
Assert.assertEquals(MockProvider.EXAMPLE_USER_FIRST_NAME, returnedFirstName);
Assert.assertEquals(MockProvider.EXAMPLE_USER_LAST_NAME, returendLastName);
Assert.assertEquals(MockProvider.EXAMPLE_USER_EMAIL, returnedEmail);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testWithoutTenantIdParameter() {
mockedQuery = setUpMockCaseInstanceQuery(Arrays.asList(MockProvider.createMockCaseInstance(null)));
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(CASE_INSTANCE_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> caseInstances = from(content).getList("");
assertThat(caseInstances).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testWithoutTenantIdParameter() {
mockedQuery = setUpMockInstanceQuery(Arrays.asList(MockProvider.createMockInstance(null)));
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(PROCESS_INSTANCE_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testWithoutTenantIdParameter() {
mockedQuery = setUpMockHistoricProcessInstanceQuery(Collections.singletonList(MockProvider.createMockHistoricProcessInstance(null)));
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testWithoutTenantIdParameter() {
mockedQuery = setUpMockHistoricCaseInstanceQuery(Arrays.asList(MockProvider.createMockHistoricCaseInstance(null)));
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(HISTORIC_CASE_INSTANCE_RESOURCE_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testDecisionDefinitionWithoutTenantId() {
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(DECISION_DEFINITION_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testDecisionRequirementsDefinitionWithoutTenantId() {
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(DECISION_REQUIREMENTS_DEFINITION_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testCaseDefinitionWithoutTenantId() {
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(CASE_DEFINITION_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testWithoutTenantIdParameter() {
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(JOB_DEFINITION_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> jobs = from(content).getList("");
assertThat(jobs).hasSize(1);
String returnedTenantId = from(content).getString("[0].tenantId");
assertThat(returnedTenantId).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testProcessDefinitionWithoutTenantId() {
Response response = given()
.queryParam("withoutTenantId", true)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(PROCESS_DEFINITION_QUERY_URL);
verify(mockedQuery).withoutTenantId();
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(1);
String returnedTenantId1 = from(content).getString("[0].tenantId");
assertThat(returnedTenantId1).isEqualTo(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testTaskCountByCandidateGroupReport() {
Response response = given()
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.contentType(ContentType.JSON)
.when()
.get(CANDIDATE_GROUP_REPORT_URL);
String content = response.asString();
List<String> reports = from(content).getList("");
Assert.assertEquals("There should be one report returned.", 1, reports.size());
Assert.assertNotNull("The returned report should not be null.", reports.get(0));
String returnedGroup = from(content).getString("[0].groupName");
int returnedCount = from(content).getInt("[0].taskCount");
Assert.assertEquals(EXAMPLE_GROUP_ID, returnedGroup);
Assert.assertEquals(EXAMPLE_TASK_COUNT_BY_CANDIDATE_GROUP, returnedCount);
}
代码示例来源:origin: camunda/camunda-bpm-platform
private void verifyTenantIdListParameterResponse(Response response) {
String content = response.asString();
List<String> historicDetails = from(content).getList("");
assertThat(historicDetails).hasSize(4);
String returnedTenantId1 = from(content).getString("[0].tenantId");
String returnedTenantId2 = from(content).getString("[1].tenantId");
String returnedTenantId3 = from(content).getString("[2].tenantId");
String returnedTenantId4 = from(content).getString("[3].tenantId");
assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
assertThat(returnedTenantId2).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
assertThat(returnedTenantId3).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
assertThat(returnedTenantId4).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
}
内容来源于网络,如有侵权,请联系作者删除!