Fix tests
This commit is contained in:
parent
ffb1a1586a
commit
a365c7aee3
@ -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)));
|
||||
}
|
Loading…
Reference in New Issue
Block a user