use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method requestSpecBuilderSupportsSettingAuthentication.
@Test
public void requestSpecBuilderSupportsSettingAuthentication() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().setAuth(basic("jetty", "jetty")).build();
given().spec(spec).expect().statusCode(200).when().get("/secured/hello");
}
use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingMultiValueParametersWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingMultiValueParametersWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addParam("list", "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 supportsMergingMultiValueParametersUsingListWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingMultiValueParametersUsingListWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addParam("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 supportsSettingConfigWhenUsingRequestSpecBuilder.
@Test
public void supportsSettingConfigWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().setConfig(newConfig().redirect(redirectConfig().followRedirects(false))).build();
given().param("url", "/hello").spec(spec).expect().statusCode(302).header("Location", is("http://localhost:8080/hello")).when().get("/redirect");
}
use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergesParametersWhenUsingRequestSpecBuilder.
@Test
public void supportsMergesParametersWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addParameter("firstName", "John").build();
given().spec(spec).param("lastName", "Doe").expect().body("greeting.firstName", equalTo("John")).body("greeting.lastName", equalTo("Doe")).when().get("/greetXML");
}
Aggregations