Fix tests
All checks were successful
Quality Check / Tests (pull_request) Successful in 1m6s
Quality Check / Checkstyle Main (pull_request) Successful in 1m10s

This commit is contained in:
Phan Huy Tran 2024-09-25 14:22:26 +02:00
parent 3c2fc08301
commit e14371c49f
20 changed files with 833 additions and 837 deletions

@ -27,7 +27,7 @@ public class CreateProjectActionTest {
private ProjectRepository projectRepository;
@Test
void test() throws Exception {
void createProjectTest() throws Exception {
String content = """
{
"name": "name",

@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.web.servlet.MockMvc;
import java.time.LocalDate;
@ -19,18 +18,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc(addFilters = false)
public class ProjectFindAllSuccess {
public class ProjectFindAllSuccessTest {
@Autowired
private ProjectRepository projectRepository;
@Autowired
private MockMvc mockMvc;
@Autowired
private TestRestTemplate restTemplate;
@Test
void findAllProjects() throws Exception {
void findAllProjectsTest() throws Exception {
var project = new ProjectEntity();
project.setId(1);
project.setComment("comment");
@ -49,11 +45,11 @@ public class ProjectFindAllSuccess {
.andExpect(jsonPath("$[0].id").value(1))
.andExpect(jsonPath("$[0].comment").value("comment"))
.andExpect(jsonPath("$[0].contractor").value(1))
.andExpect(jsonPath("$[0].contractorName").value("contractorName"))
.andExpect(jsonPath("$[0].endDate").value("01.01.2024"))
.andExpect(jsonPath("$[0].leadingEmployee").value(1))
.andExpect(jsonPath("$[0].contractor_name").value("contractorName"))
.andExpect(jsonPath("$[0].end_date").value("01.01.2024"))
.andExpect(jsonPath("$[0].leading_employee").value(1))
.andExpect(jsonPath("$[0].name").value("name"))
.andExpect(jsonPath("$[0].startDate").value("01.01.2021"))
.andExpect(jsonPath("$[0].start_date").value("01.01.2021"))
.andExpect(jsonPath("$[0].employees").isArray())
.andExpect(jsonPath("$[0].employees", hasSize(3)));
}