|
50 | 50 | import org.springframework.web.reactive.BindingContext;
|
51 | 51 | import org.springframework.web.reactive.HandlerMapping;
|
52 | 52 | import org.springframework.web.reactive.HandlerResult;
|
53 |
| -import org.springframework.web.reactive.result.method.RequestMappingInfo.BuilderConfiguration; |
| 53 | +import org.springframework.web.reactive.result.method.RequestMappingInfo.*; |
54 | 54 | import org.springframework.web.server.MethodNotAllowedException;
|
55 | 55 | import org.springframework.web.server.NotAcceptableStatusException;
|
56 | 56 | import org.springframework.web.server.ServerWebExchange;
|
57 | 57 | import org.springframework.web.server.ServerWebInputException;
|
58 | 58 | import org.springframework.web.server.UnsupportedMediaTypeStatusException;
|
59 | 59 | import org.springframework.web.util.pattern.PathPattern;
|
60 | 60 |
|
61 |
| -import static org.hamcrest.CoreMatchers.containsString; |
62 |
| -import static org.junit.Assert.assertEquals; |
63 |
| -import static org.junit.Assert.assertNotNull; |
64 |
| -import static org.junit.Assert.assertNull; |
65 |
| -import static org.junit.Assert.assertSame; |
66 |
| -import static org.junit.Assert.assertThat; |
67 |
| -import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.get; |
68 |
| -import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.method; |
69 |
| -import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.post; |
70 |
| -import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.put; |
71 |
| -import static org.springframework.web.bind.annotation.RequestMethod.GET; |
72 |
| -import static org.springframework.web.bind.annotation.RequestMethod.HEAD; |
73 |
| -import static org.springframework.web.bind.annotation.RequestMethod.OPTIONS; |
74 |
| -import static org.springframework.web.method.MvcAnnotationPredicates.getMapping; |
75 |
| -import static org.springframework.web.method.MvcAnnotationPredicates.requestMapping; |
76 |
| -import static org.springframework.web.method.ResolvableMethod.on; |
77 |
| -import static org.springframework.web.reactive.HandlerMapping.BEST_MATCHING_HANDLER_ATTRIBUTE; |
78 |
| -import static org.springframework.web.reactive.HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE; |
79 |
| -import static org.springframework.web.reactive.result.method.RequestMappingInfo.paths; |
| 61 | +import static org.hamcrest.CoreMatchers.*; |
| 62 | +import static org.junit.Assert.*; |
| 63 | +import static org.springframework.mock.http.server.reactive.test.MockServerHttpRequest.*; |
| 64 | +import static org.springframework.web.bind.annotation.RequestMethod.*; |
| 65 | +import static org.springframework.web.method.MvcAnnotationPredicates.*; |
| 66 | +import static org.springframework.web.method.ResolvableMethod.*; |
| 67 | +import static org.springframework.web.reactive.HandlerMapping.*; |
| 68 | +import static org.springframework.web.reactive.result.method.RequestMappingInfo.*; |
80 | 69 |
|
81 | 70 | /**
|
82 | 71 | * Unit tests for {@link RequestMappingInfoHandlerMapping}.
|
@@ -287,6 +276,18 @@ public void handleMatchMatrixVariables() {
|
287 | 276 | assertEquals(Arrays.asList("red", "blue", "green"), matrixVariables.get("colors"));
|
288 | 277 | assertEquals("2012", matrixVariables.getFirst("year"));
|
289 | 278 | assertEquals("cars", uriVariables.get("cars"));
|
| 279 | + |
| 280 | + // SPR-11897 |
| 281 | + exchange = MockServerWebExchange.from(get("/a=42;b=c")); |
| 282 | + handleMatch(exchange, "/{foo}"); |
| 283 | + |
| 284 | + matrixVariables = getMatrixVariables(exchange, "foo"); |
| 285 | + uriVariables = getUriTemplateVariables(exchange); |
| 286 | + |
| 287 | + assertNotNull(matrixVariables); |
| 288 | + assertEquals(1, matrixVariables.size()); |
| 289 | + assertEquals("c", matrixVariables.getFirst("b")); |
| 290 | + assertEquals("a=42", uriVariables.get("foo")); |
290 | 291 | }
|
291 | 292 |
|
292 | 293 | @Test
|
|
0 commit comments