From 2cf79e35689c83a40d83b1065c3764c6936faa93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20K=C3=BCck?= Date: Wed, 9 Oct 2024 10:51:03 +0200 Subject: [PATCH] PMT-15: Implement Tests for Responses --- .../java/de/hmmh/pmt/project/DeleteTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/test/java/de/hmmh/pmt/project/DeleteTest.java diff --git a/src/test/java/de/hmmh/pmt/project/DeleteTest.java b/src/test/java/de/hmmh/pmt/project/DeleteTest.java new file mode 100644 index 0000000..25a95ba --- /dev/null +++ b/src/test/java/de/hmmh/pmt/project/DeleteTest.java @@ -0,0 +1,31 @@ +package de.hmmh.pmt.project; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import de.hmmh.pmt.IntegrationTest; +import de.hmmh.pmt.db.Project; + +public class DeleteTest extends IntegrationTest { + @Test + void projectNotFound() throws Exception { + mvc + .perform(delete(baseUri + "/project/1")) + .andExpect(status().isNotFound()) + ; + } + + @Test + void deletedSuccessfully() throws Exception { + Map allProjects = createTestProjectData(); + mvc + .perform(delete(baseUri + "/project/" + allProjects.get("space-station").getId())) + .andExpect(status().isNoContent()) + ; + } +}