mitreid-connect / OpenID-Connect-Java-Spring-Server

An OpenID Connect reference implementation in Java on the Spring platform.
Other
1.47k stars 767 forks source link

MockMvc returns 200 for non-existing url #1452

Closed barbarosalp closed 5 years ago

barbarosalp commented 5 years ago

I have added a simple test to verify my health controller works fine:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/application-context.xml"})
@WebAppConfiguration
public class HealthControllerTest {

        @Test
        public void testGetAlive() throws Exception {
                mvc.perform(get("/non-existing-url")).andExpect(status().isOk());
        }
}

This test always returns 200. But, when we deploy the application without the default-servlet-handler, the test works as expected and returns 404 <mvc:default-servlet-handler/>

Do you have any idea, what kind of issue this might be? Thanks.

jricher commented 5 years ago

This looks to be an issue with the testing platform and not this server, you should post the issue with JUnit, Spring, or some other project/forum like StackOverflow to find an answer.