本文整理了Java中io.restassured.response.Response.jsonPath
方法的一些代码示例,展示了Response.jsonPath
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.jsonPath
方法的具体详情如下:
包路径:io.restassured.response.Response
类名称:Response
方法名:jsonPath
暂无
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetVariablesWithNullValue() {
when(caseServiceMock.getVariablesTyped(MockProvider.EXAMPLE_CASE_INSTANCE_ID, true)).thenReturn(EXAMPLE_VARIABLES_WITH_NULL_VALUE);
Response response = given().pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_ANOTHER_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_ANOTHER_VARIABLE_KEY + ".value", nullValue())
.body(EXAMPLE_ANOTHER_VARIABLE_KEY + ".type", equalTo("Null"))
.when().get(CASE_INSTANCE_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
verify(caseServiceMock).getVariablesTyped(MockProvider.EXAMPLE_CASE_INSTANCE_ID, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testJavaObjectVariableSerialization() {
when(caseServiceMock.getVariablesTyped(MockProvider.EXAMPLE_CASE_INSTANCE_ID, true)).thenReturn(EXAMPLE_OBJECT_VARIABLES);
Response response = given().pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value.property1", equalTo("aPropertyValue"))
.body(EXAMPLE_VARIABLE_KEY + ".value.property2", equalTo(true))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(ValueType.OBJECT)))
.body(EXAMPLE_VARIABLE_KEY + ".valueInfo." + SerializableValueType.VALUE_INFO_OBJECT_TYPE_NAME, equalTo(ExampleVariableObject.class.getName()))
.body(EXAMPLE_VARIABLE_KEY + ".valueInfo." + SerializableValueType.VALUE_INFO_SERIALIZATION_DATA_FORMAT, equalTo("application/json"))
.when().get(CASE_INSTANCE_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
verify(caseServiceMock).getVariablesTyped(MockProvider.EXAMPLE_CASE_INSTANCE_ID, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testJavaObjectVariableSerialization() {
Response response = given().pathParam("id", MockProvider.ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value.property1", equalTo("aPropertyValue"))
.body(EXAMPLE_VARIABLE_KEY + ".value.property2", equalTo(true))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(ValueType.OBJECT)))
.body(EXAMPLE_VARIABLE_KEY + ".valueInfo." + SerializableValueType.VALUE_INFO_OBJECT_TYPE_NAME, equalTo(ExampleVariableObject.class.getName()))
.body(EXAMPLE_VARIABLE_KEY + ".valueInfo." + SerializableValueType.VALUE_INFO_SERIALIZATION_DATA_FORMAT, equalTo("application/json"))
.when().get(PROCESS_INSTANCE_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetVariables() {
Response response = given().pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(String.class.getSimpleName()))
.when().get(CASE_INSTANCE_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
verify(caseServiceMock).getVariablesTyped(MockProvider.EXAMPLE_CASE_INSTANCE_ID, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetVariables() {
Response response = given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(String.class.getSimpleName()))
.when().get(PROCESS_INSTANCE_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetLocalVariables() {
Response response = given().pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(String.class.getSimpleName()))
.when().get(EXECUTION_LOCAL_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetVariablesWithNullValue() {
Response response = given().pathParam("id", EXAMPLE_PROCESS_INSTANCE_ID_WITH_NULL_VALUE_AS_VARIABLE)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_ANOTHER_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_ANOTHER_VARIABLE_KEY + ".value", nullValue())
.body(EXAMPLE_ANOTHER_VARIABLE_KEY + ".type", equalTo("Null"))
.when().get(PROCESS_INSTANCE_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetVariables() {
when(taskServiceMock.getVariablesTyped(EXAMPLE_TASK_ID, true)).thenReturn(EXAMPLE_VARIABLES);
Response response = given().pathParam("id", EXAMPLE_TASK_ID)
.header("accept", MediaType.APPLICATION_JSON)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(EXAMPLE_VARIABLE_VALUE.getType())))
.when().get(SINGLE_TASK_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetLocalVariables() {
when(taskServiceMock.getVariablesLocalTyped(EXAMPLE_TASK_ID, true)).thenReturn(EXAMPLE_VARIABLES);
Response response = given().pathParam("id", EXAMPLE_TASK_ID)
.header("accept", MediaType.APPLICATION_JSON)
.then().expect().statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(EXAMPLE_VARIABLE_VALUE.getType())))
.when().get(SINGLE_TASK_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
}
代码示例来源:origin: camunda/camunda-bpm-platform
.when().get(PROCESS_INSTANCE_ACTIVIY_INSTANCES_URL);
Assert.assertEquals("Should return right number of properties", 11, response.jsonPath().getMap("").size());
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetLocalVariables() {
Response response = given()
.pathParam("id", MockProvider.EXAMPLE_CASE_EXECUTION_ID)
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type", equalTo("String"))
.when()
.get(CASE_EXECUTION_LOCAL_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
verify(caseServiceMock).getVariablesLocalTyped(MockProvider.EXAMPLE_CASE_EXECUTION_ID, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetVariables() {
Response response = given()
.pathParam("id", MockProvider.EXAMPLE_CASE_EXECUTION_ID)
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.body(EXAMPLE_VARIABLE_KEY, notNullValue())
.body(EXAMPLE_VARIABLE_KEY + ".value", equalTo(EXAMPLE_VARIABLE_VALUE.getValue()))
.body(EXAMPLE_VARIABLE_KEY + ".type",
equalTo(VariableTypeHelper.toExpectedValueTypeName(EXAMPLE_VARIABLE_VALUE.getType())))
.when()
.get(CASE_EXECUTION_VARIABLES_URL);
Assert.assertEquals("Should return exactly one variable", 1, response.jsonPath().getMap("").size());
verify(caseServiceMock).getVariablesTyped(MockProvider.EXAMPLE_CASE_EXECUTION_ID, true);
}
代码示例来源:origin: HotelsDotCom/heat
/**
* Extract all wiremock requests by REST subpath.
* @param wiremockAdminRequests JSON Response of the service, represents the Wiremock admin requests
* @param urlSubPath Subpath to use in order to individuate the needed requests
* @return list of the wiremock requests
*/
public static List<Map<String, Object>> getWiremockRequestsByRequestSubpath(Response wiremockAdminRequests, String urlSubPath) {
String jsonPath = "requests.request.findAll{request -> request.url == '" + urlSubPath + "'}";
List<Map<String, Object>> wmRequests = wiremockAdminRequests.jsonPath(JSON_CONFIG).get(jsonPath);
return wmRequests;
}
代码示例来源:origin: HotelsDotCom/heat
/**
* Extract all wiremock request-response blocks by REST request subpath.
* @param wiremockAdminRequests JSON Response of the service, represents the Wiremock admin requests
* @param urlSubPath Subpath to use in order to individuate the needed block request-response
* @return list of the wiremock resppnses
*/
public static List<Map<String, Object>> getWiremockReqRespByRequestSubpath(Response wiremockAdminRequests, String urlSubPath) {
String jsonPath = "requests.findAll{requests -> requests.request.url == '" + urlSubPath + "'}";
List<Map<String, Object>> wmResponses = wiremockAdminRequests.jsonPath(JSON_CONFIG).get(jsonPath);
return wmResponses;
}
代码示例来源:origin: Frameworkium/frameworkium-core
private void deleteExistingAttachments(Integer executionId) {
String path = "attachment/attachmentsByEntity?entityType=EXECUTION&entityId=" + executionId;
getJIRARequestSpec()
.get(REST_ZAPI_PATH + path).thenReturn().jsonPath()
.getList("data.fileId", String.class)
.stream()
.map(fileId -> REST_ZAPI_PATH + "attachment/" + fileId)
.forEach(getJIRARequestSpec()::delete);
}
代码示例来源:origin: Frameworkium/frameworkium-core
private static int getTransitionId(String issueKey, String transitionName) {
return JiraConfig.getJIRARequestSpec()
.get(JIRA_REST_PATH + ISSUE_PATH + issueKey + "?expand=transitions.fields")
.thenReturn().jsonPath()
.getInt(String.format(
"transitions.find {it -> it.name == '%s'}.id", transitionName));
}
代码示例来源:origin: Frameworkium/frameworkium-core
private static String getFieldId(String fieldName) {
return JiraConfig.getJIRARequestSpec()
.when()
.get(JIRA_REST_PATH + "/field")
.thenReturn().jsonPath()
.getString(String.format("find {it.name == '%s'}.id", fieldName));
}
代码示例来源:origin: Frameworkium/frameworkium-core
/**
* Constructor which executes the given query.
*/
SearchExecutions(String query) {
jsonPath = JiraConfig.getJIRARequestSpec()
.when()
.get(JiraConfig.REST_ZAPI_PATH + "zql/executeSearch?zqlQuery=" + query)
.thenReturn().jsonPath();
}
代码示例来源:origin: marklogic/marklogic-data-hub
private void createLoginCredentials(Response projectInitResponse) {
JsonPath projectInitJson = projectInitResponse.jsonPath();
loginInfo.projectId = projectInitJson.getInt("id");
loginInfo.environment = projectInitJson.getList("environments").get(0).toString();
loginInfo.username = user;
loginInfo.password = password;
}
代码示例来源:origin: Frameworkium/frameworkium-core
/** Returns list of attachment IDs. */
public List<String> getAttachmentIds() {
return JiraConfig.getJIRARequestSpec()
.when()
.get(JiraConfig.JIRA_REST_PATH + "issue/" + issueKey)
.thenReturn().jsonPath()
.getList("fields.attachment.id");
}
内容来源于网络,如有侵权,请联系作者删除!