diff --git a/src/test/java/ch/wisv/events/admin/controller/DashboardEventControllerTest.java b/src/test/java/ch/wisv/events/admin/controller/DashboardEventControllerTest.java index 6f489165..70c9815d 100644 --- a/src/test/java/ch/wisv/events/admin/controller/DashboardEventControllerTest.java +++ b/src/test/java/ch/wisv/events/admin/controller/DashboardEventControllerTest.java @@ -3,14 +3,9 @@ import ch.wisv.events.ControllerTest; import ch.wisv.events.EventsApplicationTest; import ch.wisv.events.core.model.event.Event; -import ch.wisv.events.core.model.event.EventCategory; -import ch.wisv.events.core.model.event.EventStatus; -import ch.wisv.events.utils.LdapGroup; import com.google.common.collect.ImmutableList; import java.time.LocalDateTime; -import java.util.Optional; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -19,11 +14,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.flash; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrlPattern; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; @@ -79,7 +72,7 @@ public void testCreateGetAlreadySet() throws Exception { @Test public void testCreatePost() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -96,7 +89,7 @@ public void testCreatePost() throws Exception { @Test public void testCreatePostMissingTitle() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("shortDescription", "Short description") .param("description", "Description") @@ -112,7 +105,7 @@ public void testCreatePostMissingTitle() throws Exception { @Test public void testCreatePostMissingShortDescription() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("description", "Description") @@ -128,7 +121,7 @@ public void testCreatePostMissingShortDescription() throws Exception { @Test public void testCreatePostMissingDescription() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -144,7 +137,7 @@ public void testCreatePostMissingDescription() throws Exception { @Test public void testCreatePostMissingStart() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -160,7 +153,7 @@ public void testCreatePostMissingStart() throws Exception { @Test public void testCreatePostMissingEnd() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -176,7 +169,7 @@ public void testCreatePostMissingEnd() throws Exception { @Test public void testCreatePostMissingTarget() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -192,7 +185,7 @@ public void testCreatePostMissingTarget() throws Exception { @Test public void testCreatePostMissingMaxSoldLowerThenTarget() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -209,7 +202,7 @@ public void testCreatePostMissingMaxSoldLowerThenTarget() throws Exception { @Test public void testCreatePostMissingEndBeforeStart() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/create/") + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/create/") .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -246,7 +239,7 @@ public void testEditGetNotFound() throws Exception { public void testEditPost() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Symposium") .param("shortDescription", "Short description of Symposium") @@ -274,7 +267,7 @@ public void testEditPost() throws Exception { public void testEditPostMissingTitle() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "") .param("shortDescription", "Short description of Symposium") @@ -293,7 +286,7 @@ public void testEditPostMissingTitle() throws Exception { public void testEditPostMissingShortDescription() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("description", "Description") @@ -311,7 +304,7 @@ public void testEditPostMissingShortDescription() throws Exception { public void testEditPostMissingDescription() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -329,7 +322,7 @@ public void testEditPostMissingDescription() throws Exception { public void testEditPostMissingStart() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -347,7 +340,7 @@ public void testEditPostMissingStart() throws Exception { public void testEditPostMissingEnd() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -365,7 +358,7 @@ public void testEditPostMissingEnd() throws Exception { public void testEditPostMissingTarget() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description") @@ -383,7 +376,7 @@ public void testEditPostMissingTarget() throws Exception { public void testEditPostMissingMaxSoldLowerThenTarget() throws Exception { Event event = this.createEvent(); - mockMvc.perform(MockMvcRequestBuilders.fileUpload("/administrator/events/edit/" + event.getKey()) + mockMvc.perform(MockMvcRequestBuilders.multipart("/administrator/events/edit/" + event.getKey()) .file(new MockMultipartFile("file", "orig", null, new byte[0])) .param("title", "Events") .param("shortDescription", "Short description")