diff --git a/web/src/test/java/lcsb/mapviewer/web/PublicationsControllerIntegrationTest.java b/web/src/test/java/lcsb/mapviewer/web/PublicationsControllerIntegrationTest.java index 5b8340d0d4e1150395e5b68c9f3b5015a7464325..2bf2fc338d1b90d8b21ccafc6ac0a4b7552585d8 100644 --- a/web/src/test/java/lcsb/mapviewer/web/PublicationsControllerIntegrationTest.java +++ b/web/src/test/java/lcsb/mapviewer/web/PublicationsControllerIntegrationTest.java @@ -9,6 +9,7 @@ import org.junit.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; +import org.springframework.mock.web.MockHttpSession; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.RequestBuilder; @@ -65,4 +66,17 @@ public class PublicationsControllerIntegrationTest extends ControllerIntegration .andExpect(status().is2xxSuccessful()); } + @Test + public void testGetPublicationsWithUndefinedProject() throws Exception { + MockHttpSession session = createSession(ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_LOGIN, + ControllerIntegrationTest.BUILT_IN_TEST_ADMIN_PASSWORD); + + RequestBuilder request = get("/projects/*/models/" + map.getId() + "/publications/") + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .session(session); + + mockMvc.perform(request) + .andExpect(status().isNotFound()); + } + }