88import org .springframework .web .reactive .result .method .RequestMappingInfo ;
99import org .springframework .web .reactive .result .method .annotation .RequestMappingHandlerMapping ;
1010import org .springframework .web .server .WebFilterChain ;
11-
1211import reactor .core .publisher .Mono ;
1312import reactor .test .StepVerifier ;
1413
15-
1614@ RunWith (JUnit4 .class )
1715public class SpringSQLCommenterWebFilterTest {
1816
19- @ Test
20- public void testPreHandlePlacesStateInContextView () throws NoSuchMethodException {
21- RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping ();
22- RequestMappingInfo info = RequestMappingInfo .paths ("/test" ).build ();
23- requestMappingHandlerMapping .registerMapping (info , this , SpringSQLCommenterWebFilterTest .class .getMethod ("testPreHandlePlacesStateInContextView" ));
24-
25- SpringSQLCommenterWebFilter springSQLCommenterWebFilter = new SpringSQLCommenterWebFilter (requestMappingHandlerMapping );
26-
27- WebFilterChain filterChain = filterExchange -> Mono .empty ();
28-
29- MockServerWebExchange exchange = MockServerWebExchange .from (
30- MockServerHttpRequest
31- .get ("/test" ));
32-
33- StepVerifier .create (springSQLCommenterWebFilter .filter (exchange , filterChain ))
34- .expectAccessibleContext ()
35- .hasKey ("state" )
36- .then ()
37- .verifyComplete ();
38- }
39-
40- }
17+ @ Test
18+ public void testPreHandlePlacesStateInContextView () throws NoSuchMethodException {
19+ RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping ();
20+ RequestMappingInfo info = RequestMappingInfo .paths ("/test" ).build ();
21+ requestMappingHandlerMapping .registerMapping (
22+ info ,
23+ this ,
24+ SpringSQLCommenterWebFilterTest .class .getMethod ("testPreHandlePlacesStateInContextView" ));
25+
26+ SpringSQLCommenterWebFilter springSQLCommenterWebFilter =
27+ new SpringSQLCommenterWebFilter (requestMappingHandlerMapping );
28+
29+ WebFilterChain filterChain = filterExchange -> Mono .empty ();
30+
31+ MockServerWebExchange exchange = MockServerWebExchange .from (MockServerHttpRequest .get ("/test" ));
32+
33+ StepVerifier .create (springSQLCommenterWebFilter .filter (exchange , filterChain ))
34+ .expectAccessibleContext ()
35+ .hasKey ("state" )
36+ .then ()
37+ .verifyComplete ();
38+ }
39+ }
0 commit comments