Search in sources :

Example 1 with ExampleFilter

use of org.springframework.boot.testsupport.web.servlet.ExampleFilter in project spring-boot by spring-projects.

the class AbstractServletWebServerFactoryTests method startServletAndFilter.

@Test
void startServletAndFilter() throws Exception {
    AbstractServletWebServerFactory factory = getFactory();
    this.webServer = factory.getWebServer(exampleServletRegistration(), new FilterRegistrationBean<>(new ExampleFilter()));
    this.webServer.start();
    assertThat(getResponse(getLocalUrl("/hello"))).isEqualTo("[Hello World]");
}
Also used : ExampleFilter(org.springframework.boot.testsupport.web.servlet.ExampleFilter) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ExampleFilter (org.springframework.boot.testsupport.web.servlet.ExampleFilter)1 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)1