From 7d4266da376b8f68ccd8d99afa765dfaf33c8eaf Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Thu, 22 Aug 2019 18:19:58 +0200
Subject: [PATCH] test checking if undefined project is properly handled

---
 .../web/PublicationsControllerIntegrationTest.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/web/src/test/java/lcsb/mapviewer/web/PublicationsControllerIntegrationTest.java b/web/src/test/java/lcsb/mapviewer/web/PublicationsControllerIntegrationTest.java
index 5b8340d0d4..2bf2fc338d 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());
+  }
+
 }
-- 
GitLab