PMT-15: Implement Tests for Responses
All checks were successful
Quality Check / Validate OAS (push) Successful in 48s
Quality Check / Validate OAS (pull_request) Successful in 1m6s
Quality Check / Linting (push) Successful in 2m4s
Quality Check / Linting (pull_request) Successful in 2m7s
Quality Check / Testing (push) Successful in 2m12s
Quality Check / Static Analysis (push) Successful in 2m22s
Quality Check / Testing (pull_request) Successful in 2m12s
Quality Check / Static Analysis (pull_request) Successful in 2m16s

This commit is contained in:
Ole Kück 2024-10-09 10:51:03 +02:00
parent d725addef8
commit 2cf79e3568
Signed by: SZUT-Ole
GPG key ID: 0A1DF1B37C4A1E4C

View file

@ -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<String,Project> allProjects = createTestProjectData();
mvc
.perform(delete(baseUri + "/project/" + allProjects.get("space-station").getId()))
.andExpect(status().isNoContent())
;
}
}