test(DeleteProjectActionTest): update test project IDs for accuracy
Some checks failed
Quality Check / Tests (pull_request) Failing after 56s
Build PR / Build and analyze (pull_request) Failing after 1m12s
Quality Check / Checkstyle Main (pull_request) Successful in 33s

This commit is contained in:
Jan Gleytenhoover 2024-10-02 11:17:09 +02:00
parent 730c144c22
commit 4abce554e5
Signed by: jank
GPG Key ID: B267751B8AE29EFE

@ -11,10 +11,8 @@ import org.springframework.test.web.servlet.MockMvc;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@SpringBootTest @SpringBootTest
@ -28,7 +26,7 @@ public class DeleteProjectActionTest {
@Test @Test
void deleteProjectTest() throws Exception { void deleteProjectTest() throws Exception {
var project = new ProjectEntity(); var project = new ProjectEntity();
project.setId(1); project.setId(20);
project.setComment("comment"); project.setComment("comment");
project.setContractor(1); project.setContractor(1);
project.setContractorName("contractorName"); project.setContractorName("contractorName");
@ -39,12 +37,12 @@ public class DeleteProjectActionTest {
project.setEmployees(List.of(1L, 2L, 3L)); project.setEmployees(List.of(1L, 2L, 3L));
this.projectRepository.save(project); this.projectRepository.save(project);
this.mockMvc.perform(delete("/projects/1")) this.mockMvc.perform(delete("/projects/20"))
.andExpect(status().isNoContent()); .andExpect(status().isNoContent());
} }
@Test @Test
void deleteProjectShouldReturnNotFoundResponseWhenProjectIsNotFound() throws Exception { void deleteProjectShouldReturnNotFoundResponseWhenProjectIsNotFound() throws Exception {
this.mockMvc.perform(get("/projects/2")).andExpect(status().isNotFound()); this.mockMvc.perform(get("/projects/2987")).andExpect(status().isNotFound());
} }
} }