Fix tests
This commit is contained in:
parent
3c2fc08301
commit
e14371c49f
@ -27,7 +27,7 @@ public class CreateProjectActionTest {
|
|||||||
private ProjectRepository projectRepository;
|
private ProjectRepository projectRepository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() throws Exception {
|
void createProjectTest() throws Exception {
|
||||||
String content = """
|
String content = """
|
||||||
{
|
{
|
||||||
"name": "name",
|
"name": "name",
|
||||||
|
@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@ -19,18 +18,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@AutoConfigureMockMvc(addFilters = false)
|
@AutoConfigureMockMvc(addFilters = false)
|
||||||
public class ProjectFindAllSuccess {
|
public class ProjectFindAllSuccessTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectRepository projectRepository;
|
private ProjectRepository projectRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TestRestTemplate restTemplate;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void findAllProjects() throws Exception {
|
void findAllProjectsTest() throws Exception {
|
||||||
var project = new ProjectEntity();
|
var project = new ProjectEntity();
|
||||||
project.setId(1);
|
project.setId(1);
|
||||||
project.setComment("comment");
|
project.setComment("comment");
|
||||||
@ -49,11 +45,11 @@ public class ProjectFindAllSuccess {
|
|||||||
.andExpect(jsonPath("$[0].id").value(1))
|
.andExpect(jsonPath("$[0].id").value(1))
|
||||||
.andExpect(jsonPath("$[0].comment").value("comment"))
|
.andExpect(jsonPath("$[0].comment").value("comment"))
|
||||||
.andExpect(jsonPath("$[0].contractor").value(1))
|
.andExpect(jsonPath("$[0].contractor").value(1))
|
||||||
.andExpect(jsonPath("$[0].contractorName").value("contractorName"))
|
.andExpect(jsonPath("$[0].contractor_name").value("contractorName"))
|
||||||
.andExpect(jsonPath("$[0].endDate").value("01.01.2024"))
|
.andExpect(jsonPath("$[0].end_date").value("01.01.2024"))
|
||||||
.andExpect(jsonPath("$[0].leadingEmployee").value(1))
|
.andExpect(jsonPath("$[0].leading_employee").value(1))
|
||||||
.andExpect(jsonPath("$[0].name").value("name"))
|
.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").isArray())
|
||||||
.andExpect(jsonPath("$[0].employees", hasSize(3)));
|
.andExpect(jsonPath("$[0].employees", hasSize(3)));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user