use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingRequestSpecHeadersUsingTheBuilder.
@Test
public void supportsMergingRequestSpecHeadersUsingTheBuilder() throws Exception {
final RequestSpecification spec = given().header("header2", "value2");
final RequestSpecification spec2 = new RequestSpecBuilder().addHeader("header1", "value1").addRequestSpecification(spec).build();
given().spec(spec2).header("header3", "value3").expect().body(containsString("header1")).body(containsString("header2")).body(containsString("header3")).when().get("/header");
}
use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingMultiValueQueryParametersUsingListWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingMultiValueQueryParametersUsingListWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addQueryParam("list", asList("1", "2", "3")).build();
given().spec(spec).expect().body("list", equalTo("1,2,3")).when().get("/multiValueParam");
}
use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingFormParametersWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingFormParametersWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addFormParam("lastName", "Doe").build();
given().spec(spec).formParameter("firstName", "John").expect().body("greeting", Matchers.equalTo("Greetings John Doe")).when().put("/greetPut");
}
use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsSettingLoggingWhenUsingRequestSpecBuilder.
@Test
public void supportsSettingLoggingWhenUsingRequestSpecBuilder() throws Exception {
final StringWriter writer = new StringWriter();
final PrintStream captor = new PrintStream(new WriterOutputStream(writer), true);
final RequestSpecification spec = new RequestSpecBuilder().setConfig(newConfig().logConfig(logConfig().defaultStream(captor))).and().log(ALL).build();
given().spec(spec).pathParameter("firstName", "John").pathParameter("lastName", "Doe").when().get("/{firstName}/{lastName}").then().body("fullName", equalTo("John Doe"));
assertThat(writer.toString(), equalTo("Request method:\tGET\nRequest URI:\thttp://localhost:8080/John/Doe\nProxy:\t\t\t<none>\nRequest params:\t<none>\nQuery params:\t<none>\nForm params:\t<none>\nPath params:\tfirstName=John\n\t\t\t\tlastName=Doe\nHeaders:\t\tAccept=*/*\nCookies:\t\t<none>\nMultiparts:\t\t<none>\nBody:\t\t\t<none>\n"));
}
use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingPathParametersWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingPathParametersWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addPathParam("lastName", "Doe").build();
given().spec(spec).pathParameter("firstName", "John").expect().body("fullName", equalTo("John Doe")).when().get("/{firstName}/{lastName}");
}
Aggregations