|
18 | 18 |
|
19 | 19 | import java.io.File;
|
20 | 20 | import java.util.Collections;
|
| 21 | +import java.util.EnumSet; |
21 | 22 | import java.util.Locale;
|
22 | 23 |
|
| 24 | +import javax.servlet.DispatcherType; |
| 25 | + |
23 | 26 | import nz.net.ultraq.thymeleaf.LayoutDialect;
|
24 | 27 | import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy;
|
25 | 28 | import org.junit.After;
|
|
37 | 40 | import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
38 | 41 | import org.springframework.boot.test.rule.OutputCapture;
|
39 | 42 | import org.springframework.boot.test.util.TestPropertyValues;
|
| 43 | +import org.springframework.boot.web.servlet.FilterRegistrationBean; |
40 | 44 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
41 | 45 | import org.springframework.context.annotation.Bean;
|
42 | 46 | import org.springframework.context.annotation.Configuration;
|
|
47 | 51 | import org.springframework.test.util.ReflectionTestUtils;
|
48 | 52 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
49 | 53 | import org.springframework.web.servlet.ViewResolver;
|
50 |
| -import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; |
51 | 54 | import org.springframework.web.servlet.support.RequestContext;
|
52 | 55 |
|
53 | 56 | import static org.assertj.core.api.Assertions.assertThat;
|
|
61 | 64 | * @author Eddú Meléndez
|
62 | 65 | * @author Brian Clozel
|
63 | 66 | * @author Kazuki Shimizu
|
| 67 | + * @author Artsiom Yudovin |
64 | 68 | */
|
65 | 69 | public class ThymeleafServletAutoConfigurationTests {
|
66 | 70 |
|
@@ -205,14 +209,17 @@ public void renderNonWebAppTemplate() {
|
205 | 209 | @Test
|
206 | 210 | public void registerResourceHandlingFilterDisabledByDefault() {
|
207 | 211 | load(BaseConfiguration.class);
|
208 |
| - assertThat(this.context.getBeansOfType(ResourceUrlEncodingFilter.class)) |
209 |
| - .isEmpty(); |
| 212 | + assertThat(this.context.getBeansOfType(FilterRegistrationBean.class)).isEmpty(); |
210 | 213 | }
|
211 | 214 |
|
212 | 215 | @Test
|
213 | 216 | public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled() {
|
214 | 217 | load(BaseConfiguration.class, "spring.resources.chain.enabled:true");
|
215 |
| - assertThat(this.context.getBean(ResourceUrlEncodingFilter.class)).isNotNull(); |
| 218 | + FilterRegistrationBean<?> registration = this.context |
| 219 | + .getBean(FilterRegistrationBean.class); |
| 220 | + assertThat(registration).isNotNull(); |
| 221 | + assertThat(registration).hasFieldOrPropertyWithValue("dispatcherTypes", |
| 222 | + EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR)); |
216 | 223 | }
|
217 | 224 |
|
218 | 225 | @Test
|
|
0 commit comments