I created a Resource server example project using Spring WebMvc RouterFunction and Auth0 IDP.
https://github.com/hantsy/spring-webmvc-auth0-sample
When adding tests, I followed the Spring Security Samples.
I tried to use @MockMvc to test the functionality but failed. The @MockMvc can not recognize RouterFunction bean and the new Spring Security Servlet SecurityFilterChain.
Then I created a MockMvc from WebApplicationContext, check https://github.com/hantsy/spring-webmvc-auth0-sample/blob/master/src/test/java/com/example/demo/ApplicationTests.java, but failed due to an exception.
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.test.web.servlet.DefaultMvcResult.setHandler(Object)" because "mvcResult" is null
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
Also posted on stackoverflow, https://stackoverflow.com/questions/67171628/resource-server-test-failes-with-auth0-issuer-uri
I created a Resource server example project using Spring WebMvc RouterFunction and Auth0 IDP.
https://github.com/hantsy/spring-webmvc-auth0-sample
When adding tests, I followed the Spring Security Samples.
I tried to use
@MockMvcto test the functionality but failed. The@MockMvccan not recognizeRouterFunctionbean and the new Spring Security ServletSecurityFilterChain.Then I created a
MockMvcfromWebApplicationContext, check https://github.com/hantsy/spring-webmvc-auth0-sample/blob/master/src/test/java/com/example/demo/ApplicationTests.java, but failed due to an exception.Also posted on stackoverflow, https://stackoverflow.com/questions/67171628/resource-server-test-failes-with-auth0-issuer-uri