|
46 | 46 | /** |
47 | 47 | * Tests for {@link CorsGatewayFilterApplicationListener}. |
48 | 48 | * |
49 | | - * <p>This test verifies that the merged CORS configurations composed of global and |
50 | | - * per-route metadata maintain insertion order as defined by the use of {@link LinkedHashMap}. |
| 49 | + * <p>This test verifies that the merged CORS configurations - composed of per-route metadata |
| 50 | + * and at the global level - maintain insertion order, as defined by the use of {@link LinkedHashMap}. |
51 | 51 | * Preserving insertion order helps for predictable and deterministic CORS behavior |
52 | 52 | * when resolving multiple matching path patterns. |
53 | 53 | * </p> |
|
56 | 56 | * that the resulting configuration map passed to {@link RoutePredicateHandlerMapping#setCorsConfigurations(Map)} |
57 | 57 | * respects the declared order of: |
58 | 58 | * <ul> |
59 | | - * <li>Global CORS configurations (in insertion order)</li> |
60 | 59 | * <li>Route-specific CORS configurations (in the order the routes are discovered)</li> |
| 60 | + * <li>Global CORS configurations (in insertion order)</li> |
61 | 61 | * </ul> |
62 | 62 | * </p> |
63 | 63 | * |
@@ -118,8 +118,8 @@ void testOnApplicationEvent_preservesInsertionOrder_withRealRoutes() { |
118 | 118 | verify(handlerMapping).setCorsConfigurations(corsConfigurations.capture()); |
119 | 119 |
|
120 | 120 | Map<String, CorsConfiguration> mergedCorsConfigurations = corsConfigurations.getValue(); |
121 | | - assertThat(mergedCorsConfigurations.keySet()).containsExactly(GLOBAL_PATH_1, |
122 | | - GLOBAL_PATH_2, ROUTE_PATH_1, ROUTE_PATH_2); |
| 121 | + assertThat(mergedCorsConfigurations.keySet()) |
| 122 | + .containsExactly(ROUTE_PATH_1, ROUTE_PATH_2, GLOBAL_PATH_1, GLOBAL_PATH_2); |
123 | 123 | assertThat(mergedCorsConfigurations.get(GLOBAL_PATH_1).getAllowedOrigins()) |
124 | 124 | .containsExactly(ORIGIN_GLOBAL_1); |
125 | 125 | assertThat(mergedCorsConfigurations.get(GLOBAL_PATH_2).getAllowedOrigins()) |
|
0 commit comments