File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 18
18
19
19
import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .get ;
20
20
import static org .springframework .test .web .servlet .result .MockMvcResultHandlers .print ;
21
+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .content ;
21
22
import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
22
23
import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
23
24
import static sample .JWKSetEndpoint .WELL_KNOWN_JWK_URIS ;
24
25
26
+ import org .hamcrest .Matchers ;
25
27
import org .junit .jupiter .api .BeforeAll ;
26
28
import org .junit .jupiter .api .Test ;
27
29
import org .junit .jupiter .api .TestInstance ;
@@ -45,11 +47,19 @@ void setup() {
45
47
}
46
48
47
49
@ Test
48
- void testJwkEndpoint () throws Exception {
50
+ void testIfRequestMatches () throws Exception {
49
51
mvc .perform (get (WELL_KNOWN_JWK_URIS ))
50
52
.andDo (print ())
51
53
.andExpect (status ().isOk ())
52
54
.andExpect (jsonPath ("$.keys" ).isArray ())
53
55
.andExpect (jsonPath ("$.keys" ).isEmpty ());
54
56
}
57
+
58
+ @ Test
59
+ void testIfNotRequestMatches () throws Exception {
60
+ mvc .perform (get ("/fake" ))
61
+ .andDo (print ())
62
+ .andExpect (status ().isOk ())
63
+ .andExpect (content ().string (Matchers .is ("fake" )));
64
+ }
55
65
}
You can’t perform that action at this time.
0 commit comments