feat(project): Delete project (SCRUM-35) #29

Merged
jank merged 8 commits from feature/remove-project into main 2024-10-02 09:43:10 +00:00
Showing only changes of commit 4abce554e5 - Show all commits

@ -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());
} }
} }