8
8
import org .springframework .web .reactive .result .method .RequestMappingInfo ;
9
9
import org .springframework .web .reactive .result .method .annotation .RequestMappingHandlerMapping ;
10
10
import org .springframework .web .server .WebFilterChain ;
11
-
12
11
import reactor .core .publisher .Mono ;
13
12
import reactor .test .StepVerifier ;
14
13
15
-
16
14
@ RunWith (JUnit4 .class )
17
15
public class SpringSQLCommenterWebFilterTest {
18
16
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