use of io.restassured.module.mockmvc.specification.MockMvcRequestSpecBuilder in project rest-assured by rest-assured.
the class AutoSpringSecurityConfigurerITest method spring_security_configurer_is_automatically_applied_when_spring_security_test_is_in_classpath_when_using_a_specifications_applied_after_web_app_context_setup.
@Test
public void spring_security_configurer_is_automatically_applied_when_spring_security_test_is_in_classpath_when_using_a_specifications_applied_after_web_app_context_setup() {
MockMvcRequestSpecification specification = new MockMvcRequestSpecBuilder().setPostProcessors(httpBasic("username", "password")).build();
RestAssuredMockMvc.given().webAppContextSetup(context).spec(specification).param("name", "Johan").when().get("/secured/greeting").then().statusCode(200).body("content", equalTo("Hello, Johan!")).expect(authenticated().withUsername("username"));
}
Aggregations