use of io.restassured.builder.ResponseSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method responseSpecificationCanExpectContentWithArgs.
@Test
public void responseSpecificationCanExpectContentWithArgs() throws Exception {
final ResponseSpecification spec = new ResponseSpecBuilder().rootPath("store.book[%d]").expectContent("author", withArgs(0), equalTo("Nigel Rees")).build();
expect().spec(spec).content("title", withArgs(1), equalTo("Sword of Honour")).when().get("/jsonStore");
}
use of io.restassured.builder.ResponseSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method responseSpecificationCanExpectBodyWithArgs.
@Test
public void responseSpecificationCanExpectBodyWithArgs() throws Exception {
final ResponseSpecification spec = new ResponseSpecBuilder().rootPath("store.book[%d]").expectBody("author", withArgs(0), equalTo("Nigel Rees")).build();
expect().spec(spec).body("title", withArgs(1), equalTo("Sword of Honour")).when().get("/jsonStore");
}
use of io.restassured.builder.ResponseSpecBuilder in project rest-assured by rest-assured.
the class XMLGetITest method supportsRegisteringCustomParserForAGivenMimeTypeUsingResponseSpec.
@Test
public void supportsRegisteringCustomParserForAGivenMimeTypeUsingResponseSpec() throws Exception {
final String mimeType = "application/something-custom";
final ResponseSpecification specification = new ResponseSpecBuilder().registerParser(mimeType, Parser.XML).build();
RestAssured.expect().specification(specification).and().body("body.message", equalTo("Custom mime-type")).when().get("/customMimeType");
}
use of io.restassured.builder.ResponseSpecBuilder in project rest-assured by rest-assured.
the class ResponseTimeITest method response_time_validation_can_be_specified_in_specification.
@Test
public void response_time_validation_can_be_specified_in_specification() {
ResponseSpecification spec = new ResponseSpecBuilder().expectResponseTime(lessThanOrEqualTo(3000L)).build();
given().param("firstName", "John").param("lastName", "Doe").when().get("/greet").then().spec(spec);
}
use of io.restassured.builder.ResponseSpecBuilder in project rest-assured by rest-assured.
the class ResponseTimeITest method response_time_validation_can_fail_when_specified_in_specification.
@Test
public void response_time_validation_can_fail_when_specified_in_specification() {
exception.expect(AssertionError.class);
exception.expectMessage("Expected response time was not a value less than or equal to <3L> nanoseconds, was");
ResponseSpecification spec = new ResponseSpecBuilder().expectResponseTime(lessThanOrEqualTo(3L), NANOSECONDS).build();
given().param("firstName", "John").param("lastName", "Doe").when().get("/greet").then().spec(spec);
}
Aggregations