feat(project): Delete project (SCRUM-35) #29
@ -11,10 +11,8 @@ import org.springframework.test.web.servlet.MockMvc;
|
||||
import java.time.LocalDate;
|
||||
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.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@SpringBootTest
|
||||
@ -28,7 +26,7 @@ public class DeleteProjectActionTest {
|
||||
@Test
|
||||
void deleteProjectTest() throws Exception {
|
||||
var project = new ProjectEntity();
|
||||
project.setId(1);
|
||||
project.setId(20);
|
||||
project.setComment("comment");
|
||||
project.setContractor(1);
|
||||
project.setContractorName("contractorName");
|
||||
@ -39,12 +37,12 @@ public class DeleteProjectActionTest {
|
||||
project.setEmployees(List.of(1L, 2L, 3L));
|
||||
this.projectRepository.save(project);
|
||||
|
||||
this.mockMvc.perform(delete("/projects/1"))
|
||||
this.mockMvc.perform(delete("/projects/20"))
|
||||
.andExpect(status().isNoContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteProjectShouldReturnNotFoundResponseWhenProjectIsNotFound() throws Exception {
|
||||
this.mockMvc.perform(get("/projects/2")).andExpect(status().isNotFound());
|
||||
this.mockMvc.perform(get("/projects/2987")).andExpect(status().isNotFound());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user