Skip to content

Commit a583449

Browse files
committed
spring-projects#2 test request does not match the filter
1 parent 6d25c79 commit a583449

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/test/java/sample/JWKSetEndpointTest.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818

1919
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
2020
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
21+
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
2122
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
2223
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
2324
import static sample.JWKSetEndpoint.WELL_KNOWN_JWK_URIS;
2425

26+
import org.hamcrest.Matchers;
2527
import org.junit.jupiter.api.BeforeAll;
2628
import org.junit.jupiter.api.Test;
2729
import org.junit.jupiter.api.TestInstance;
@@ -45,11 +47,19 @@ void setup() {
4547
}
4648

4749
@Test
48-
void testJwkEndpoint() throws Exception {
50+
void testIfRequestMatches() throws Exception {
4951
mvc.perform(get(WELL_KNOWN_JWK_URIS))
5052
.andDo(print())
5153
.andExpect(status().isOk())
5254
.andExpect(jsonPath("$.keys").isArray())
5355
.andExpect(jsonPath("$.keys").isEmpty());
5456
}
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+
}
5565
}

0 commit comments

Comments
 (0)