spring-boottestingcontextpath

Spring Boot context-path doesn't return index.html in tests


I want to test that GET "/" returns index.html (Which is the case in a build) but when I try that in an integration test I get 404 NOT FOUND. Here's how I test:

mvc.perform(get("/"));

application.properties:

server.servlet.context-path=/

Again, this works as expected with a browser/REST client.

Thanks


Solution

  • Although it makes no sense to me, the problem was the accept type - application/json. Changed it to / and it worked