|
18 | 18 |
|
19 | 19 | import java.util.Collection; |
20 | 20 | import java.util.EnumSet; |
| 21 | +import java.util.Map; |
21 | 22 |
|
22 | 23 | import jakarta.servlet.DispatcherType; |
23 | 24 | import jakarta.servlet.Filter; |
@@ -144,8 +145,8 @@ void shouldApplyFilterRegistrationAnnotation() { |
144 | 145 | assertThat(filterRegistrationBean.getServletNames()).containsExactly("test"); |
145 | 146 | assertThat(filterRegistrationBean.determineDispatcherTypes()).containsExactly(DispatcherType.ERROR); |
146 | 147 | assertThat(filterRegistrationBean.getUrlPatterns()).containsExactly("/test/*"); |
147 | | - assertThat(filterRegistrationBean.getInitParameters()).containsEntry("env", "test") |
148 | | - .containsEntry("debug", "true"); |
| 148 | + assertThat(filterRegistrationBean.getInitParameters()) |
| 149 | + .containsExactlyInAnyOrderEntriesOf(Map.of("env", "test", "debug", "true")); |
149 | 150 | Collection<ServletRegistrationBean<?>> servletRegistrationBeans = filterRegistrationBean |
150 | 151 | .getServletRegistrationBeans(); |
151 | 152 | assertThat(servletRegistrationBeans).hasSize(1); |
@@ -305,12 +306,11 @@ TestFilter testFilter() { |
305 | 306 | static class FilterConfigurationWithAnnotation { |
306 | 307 |
|
307 | 308 | @Bean |
308 | | - @FilterRegistration(enabled = false, name = "test", asyncSupported = false, |
309 | | - dispatcherTypes = DispatcherType.ERROR, matchAfter = true, servletNames = "test", |
310 | | - urlPatterns = "/test/*", |
311 | | - initParameters = { @WebInitParam(name = "env", value = "test"), |
312 | | - @WebInitParam(name = "debug", value = "true") }, |
313 | | - servletRegistrationBeans = { TestServlet.class }) |
| 309 | + @FilterRegistration( |
| 310 | + enabled = false, name = "test", asyncSupported = false, dispatcherTypes = DispatcherType.ERROR, |
| 311 | + matchAfter = true, servletNames = "test", urlPatterns = "/test/*", initParameters = { |
| 312 | + @WebInitParam(name = "env", value = "test"), @WebInitParam(name = "debug", value = "true") }, |
| 313 | + servletClasses = { TestServlet.class }) |
314 | 314 | TestFilter testFilter() { |
315 | 315 | return new TestFilter(); |
316 | 316 | } |
|
0 commit comments