use of io.restassured.specification.ResponseSpecification in project rest-assured by rest-assured.
the class JSONGetITest method specificationSyntax.
@Test
public void specificationSyntax() throws Exception {
final RequestSpecification requestSpecification = with().parameters("firstName", "John", "lastName", "Doe");
final ResponseSpecification responseSpecification = expect().body("greeting", equalTo("Greetings John Doe"));
given(requestSpecification, responseSpecification).get("/greet");
}
use of io.restassured.specification.ResponseSpecification in project rest-assured by rest-assured.
the class JSONPostITest method requestContentType.
@Test
public void requestContentType() throws Exception {
final RequestSpecification requestSpecification = given().contentType(ContentType.URLENC).with().parameters("firstName", "John", "lastName", "Doe");
final ResponseSpecification responseSpecification = expect().contentType(ContentType.JSON).and().body("greeting", equalTo("Greetings John Doe"));
given(requestSpecification, responseSpecification).post("/greet");
}
use of io.restassured.specification.ResponseSpecification in project vertigo by KleeGroup.
the class WebServiceManagerTest method doPaginedSearch.
private String doPaginedSearch(final Map<String, Object> criteriaContact, final Integer top, final Integer skip, final String sortFieldName, final Boolean sortDesc, final String listServerToken, final int expectedSize, final String firstContactName, final String lastContactName, final boolean isAuto) {
final RequestSpecification given = given().filter(loggedSessionFilter);
final String wsUrl = isAuto ? "/test/_searchAutoPagined" : "/test/_searchQueryPagined";
if (top != null) {
given.queryParam("top", top);
}
if (skip != null) {
given.queryParam("skip", skip);
}
if (sortFieldName != null) {
given.queryParam("sortFieldName", sortFieldName);
}
if (sortDesc != null) {
given.queryParam("sortDesc", sortDesc);
}
if (listServerToken != null) {
given.queryParam("listServerToken", listServerToken);
}
ResponseSpecification responseSpecification = given.body(criteriaContact).expect().body("size()", Matchers.equalTo(expectedSize));
if (expectedSize > 0) {
responseSpecification = responseSpecification.body("get(0).name", Matchers.equalTo(firstContactName)).body("get(" + (expectedSize - 1) + ").name", Matchers.equalTo(lastContactName));
}
final String newListServerToken = responseSpecification.statusCode(HttpStatus.SC_OK).when().post(wsUrl).header("listServerToken");
return newListServerToken;
}
Aggregations