|
16 | 16 |
|
17 | 17 | package org.springframework.web.reactive.config;
|
18 | 18 |
|
19 |
| -import java.lang.reflect.Field; |
20 | 19 | import java.nio.ByteBuffer;
|
21 | 20 | import java.security.Principal;
|
22 | 21 | import java.util.Collections;
|
|
48 | 47 | import org.springframework.util.MimeType;
|
49 | 48 | import org.springframework.util.MimeTypeUtils;
|
50 | 49 | import org.springframework.util.MultiValueMap;
|
51 |
| -import org.springframework.util.ReflectionUtils; |
52 | 50 | import org.springframework.validation.Validator;
|
53 | 51 | import org.springframework.web.bind.annotation.GetMapping;
|
54 | 52 | import org.springframework.web.bind.annotation.RequestMapping;
|
|
71 | 69 | import org.springframework.web.reactive.result.view.ViewResolver;
|
72 | 70 | import org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer;
|
73 | 71 | import org.springframework.web.reactive.result.view.freemarker.FreeMarkerViewResolver;
|
74 |
| -import org.springframework.web.server.ServerWebExchange; |
75 | 72 | import org.springframework.web.server.WebHandler;
|
76 |
| -import org.springframework.web.testfixture.server.MockServerWebExchange; |
77 | 73 | import org.springframework.web.util.pattern.PathPatternParser;
|
78 | 74 |
|
79 | 75 | import static org.assertj.core.api.Assertions.assertThat;
|
|
87 | 83 | import static org.springframework.http.MediaType.APPLICATION_XML;
|
88 | 84 | import static org.springframework.http.MediaType.IMAGE_PNG;
|
89 | 85 | import static org.springframework.http.MediaType.TEXT_PLAIN;
|
90 |
| -import static org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest.get; |
91 | 86 |
|
92 | 87 | /**
|
93 | 88 | * Tests for {@link WebFluxConfigurationSupport}.
|
|
96 | 91 | */
|
97 | 92 | class WebFluxConfigurationSupportTests {
|
98 | 93 |
|
99 |
| - @Test |
100 |
| - void requestMappingHandlerMapping() { |
101 |
| - ApplicationContext context = loadConfig(WebFluxConfig.class); |
102 |
| - Field field = ReflectionUtils.findField(PathPatternParser.class, "matchOptionalTrailingSeparator"); |
103 |
| - assertThat(field).isNotNull(); |
104 |
| - ReflectionUtils.makeAccessible(field); |
105 |
| - |
106 |
| - String name = "requestMappingHandlerMapping"; |
107 |
| - RequestMappingHandlerMapping mapping = context.getBean(name, RequestMappingHandlerMapping.class); |
108 |
| - assertThat(mapping).isNotNull(); |
109 |
| - |
110 |
| - assertThat(mapping.getOrder()).isEqualTo(0); |
111 |
| - |
112 |
| - PathPatternParser patternParser = mapping.getPathPatternParser(); |
113 |
| - assertThat(patternParser).hasFieldOrPropertyWithValue("matchOptionalTrailingSeparator", false); |
114 |
| - |
115 |
| - name = "webFluxContentTypeResolver"; |
116 |
| - RequestedContentTypeResolver resolver = context.getBean(name, RequestedContentTypeResolver.class); |
117 |
| - assertThat(mapping.getContentTypeResolver()).isSameAs(resolver); |
118 |
| - |
119 |
| - ServerWebExchange exchange = MockServerWebExchange.from(get("/path").accept(MediaType.APPLICATION_JSON)); |
120 |
| - assertThat(resolver.resolveMediaTypes(exchange)) |
121 |
| - .isEqualTo(Collections.singletonList(MediaType.APPLICATION_JSON)); |
122 |
| - } |
123 |
| - |
124 | 94 | @Test
|
125 | 95 | void customPathMatchConfig() {
|
126 | 96 | ApplicationContext context = loadConfig(CustomPatchMatchConfig.class);
|
|
0 commit comments