本文整理了Java中io.restassured.response.Response.body
方法的一些代码示例,展示了Response.body
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.body
方法的具体详情如下:
包路径:io.restassured.response.Response
类名称:Response
方法名:body
暂无
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetStartFormVariables() {
given().pathParam("id", EXAMPLE_PROCESS_DEFINITION_ID)
.then().expect()
.statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON)
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value", equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue()))
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type",
equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType())))
.when().get(START_FORM_VARIABLES_URL)
.body();
verify(formServiceMock, times(1)).getStartFormVariables(EXAMPLE_PROCESS_DEFINITION_ID, null, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetTaskFormVariables() {
given().pathParam("id", EXAMPLE_TASK_ID)
.header("accept", MediaType.APPLICATION_JSON)
.then().expect()
.statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON)
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type",
equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType())))
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value",
equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue()))
.when().get(FORM_VARIABLES_URL)
.body();
verify(formServiceMock, times(1)).getTaskFormVariables(EXAMPLE_TASK_ID, null, true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetStartFormVariablesAndDoNotDeserializeVariables() {
given()
.pathParam("id", EXAMPLE_PROCESS_DEFINITION_ID)
.queryParam("deserializeValues", false)
.then()
.expect()
.statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON)
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value", equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue()))
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type",
equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType())))
.when().get(START_FORM_VARIABLES_URL)
.body();
verify(formServiceMock, times(1)).getStartFormVariables(EXAMPLE_PROCESS_DEFINITION_ID, null, false);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetTaskFormVariablesAndDoNotDeserializeVariables() {
given()
.pathParam("id", EXAMPLE_TASK_ID)
.queryParam("deserializeValues", false)
.header("accept", MediaType.APPLICATION_JSON)
.then().expect()
.statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON)
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type",
equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType())))
.body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value",
equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue()))
.when().get(FORM_VARIABLES_URL)
.body();
verify(formServiceMock, times(1)).getTaskFormVariables(EXAMPLE_TASK_ID, null, false);
}
代码示例来源:origin: lv.ctco.cukes/cukes-http
@Override
protected boolean matchesSafely(Integer statusCode, Description description) {
description.appendText(format("was \"%d\"", statusCode));
if (appendBody) {
final String body = response.body().asString();
final int size = body.length();
if (response.getContentType().equals("application/octet-stream")) {
description.appendText(" with body <binary>");
} else if (maxSize != null && size > maxSize) {
description.appendText(" with body <exceeding max size to show>");
} else {
description.appendText(format(" with body:\n\"\"\"\n%s\n\"\"\"", body));
}
}
return expectedStatusCode.equals(statusCode);
}
代码示例来源:origin: ctco/cukes
@Override
protected boolean matchesSafely(Integer statusCode, Description description) {
description.appendText(format("was \"%d\"", statusCode));
if (appendBody) {
final String body = response.body().asString();
final int size = body.length();
if (response.getContentType().equals("application/octet-stream")) {
description.appendText(" with body <binary>");
} else if (maxSize != null && size > maxSize) {
description.appendText(" with body <exceeding max size to show>");
} else {
description.appendText(format(" with body:\n\"\"\"\n%s\n\"\"\"", body));
}
}
return expectedStatusCode.equals(statusCode);
}
代码示例来源:origin: epam/JDI
public T callAsData(Class<T> c) {
try {
return call().raResponse().body().as(c);
} catch (Exception ex) {
throw new RuntimeException("Can't convert response in " + c.getSimpleName());
}
}
public T asData(Class<T> c) {
代码示例来源:origin: epam/JDI
public String getFromHtml(String path) {
return raResponse.body().htmlPath().getString(path);
}
代码示例来源:origin: lv.ctco.cukes/cukes-http
@Override
public void bodyDoesNotContainPath(String path) {
Object value = this.facade.response().body().path(getPath(path));
assertThat(value, nullValue());
}
代码示例来源:origin: ctco/cukes
@Override
public void bodyDoesNotContainPath(String path) {
Object value = this.facade.response().body().path(getPath(path));
assertThat(value, nullValue());
}
代码示例来源:origin: epam/JDI
public RestResponse(Response raResponse, long time) {
this.raResponse = raResponse;
responseTimeMSec = time;
body = raResponse.body().asString();
status = new ResponseStatus(raResponse);
contenType = raResponse.contentType();
logger.info(toString());
}
public RestResponse set(JActionT<RestResponse> valueFunc) {
代码示例来源:origin: ctco/cukes
@Override
public void varAssignedFromProperty(@InflateContext.Ignore String varName, String property) {
String value = String.valueOf(this.facade.response().body().<Object>path(getPath(property)));
this.world.put(varName, value);
}
代码示例来源:origin: lv.ctco.cukes/cukes-http
@Override
public void varAssignedFromProperty(@InflateContext.Ignore String varName, String property) {
String value = String.valueOf(this.facade.response().body().<Object>path(getPath(property)));
this.world.put(varName, value);
}
代码示例来源:origin: lv.ctco.cukes/cukes-http
@Override
public void varAssignedFromBody(@InflateContext.Ignore String varName) {
String value = this.facade.response().body().asString();
this.world.put(varName, value);
}
代码示例来源:origin: ctco/cukes
@Override
public void varAssignedFromBody(@InflateContext.Ignore String varName) {
String value = this.facade.response().body().asString();
this.world.put(varName, value);
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
private String fromGoodContinuationTokenRequest() {
return with()
.contentType(ContentType.JSON)
.accept(ContentType.JSON)
.body("{\"username\": \"" + userCredentials.getUsername() + "\", \"clientName\": \"Mozilla Thunderbird\", \"clientVersion\": \"42.0\", \"deviceName\": \"Joe Blogg’s iPhone\"}")
.post("/authentication")
.body()
.path("continuationToken")
.toString();
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
public static List<Map<String, String>> getAllMailboxesIds(AccessToken accessToken) {
return with()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"properties\": [\"role\", \"id\"]}, \"#0\"]]")
.post("/jmap")
.andReturn()
.body()
.jsonPath()
.getList(ARGUMENTS + ".list");
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
private List<Map<String, String>> getAllMailboxesIds(AccessToken accessToken) {
return with()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"properties\": [\"role\", \"id\"]}, \"#0\"]]")
.post("/jmap")
.andReturn()
.body()
.jsonPath()
.getList(ARGUMENTS + ".list");
}
代码示例来源:origin: org.apache.james/james-server-jmap-integration-testing
default List<Map<String, String>> getAllMailboxesIds(AccessToken accessToken) {
return with()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"properties\": [\"role\", \"id\"]}, \"#0\"]]")
.post("/jmap")
.andReturn()
.body()
.jsonPath()
.getList(ARGUMENTS + ".list");
}
内容来源于网络,如有侵权,请联系作者删除!