From cf62906161849512c231f8f5fd495e556125bb73 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 | 30 +++++++++++++++++++ 1 file changed, 30 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..21a8eb3 --- /dev/null +++ b/src/test/java/de/hmmh/pmt/project/DeleteTest.java @@ -0,0 +1,30 @@ +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 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 { + List allProjects = createTestProjectData(); + mvc + .perform(delete(baseUri + "/project/" + allProjects.get(1).getId())) + .andExpect(status().isNoContent()) + ; + } +}