fix (kinda) : refactored update of data, still trying to fix bug
from EntrepreneurApiServiceTests (code is a bit messy with prints and comments dw)
This commit is contained in:
@ -28,6 +28,7 @@ import java.util.List;
|
||||
@Transactional
|
||||
public class EntrepreneurApiServiceTest {
|
||||
private static Entrepreneur entrepreneur;
|
||||
private static Project project;
|
||||
private static Iterable<SectionCell> sectionCells;
|
||||
@Autowired private EntrepreneurApiService entrepreneurApiService;
|
||||
@Autowired private EntrepreneurService entrepreneurService;
|
||||
@ -60,20 +61,22 @@ public class EntrepreneurApiServiceTest {
|
||||
"ENSEGID",
|
||||
"",
|
||||
true));
|
||||
Project project =
|
||||
project =
|
||||
projectService.addNewProject(
|
||||
new Project("Project", null, LocalDate.now(), ACTIVE, null, entrepreneur));
|
||||
entrepreneur.setProjectParticipation(project);
|
||||
// projectService.updateProjectEntrepreneurParticipation(project.getIdProject(),
|
||||
// entrepreneur); proxy error because why not
|
||||
entrepreneurService.updateEntrepreneurProjectProposed(entrepreneur.getIdUser(), project);
|
||||
entrepreneurService.updateEntrepreneurProjectParticipation(
|
||||
entrepreneur.getIdUser(), project);
|
||||
System.out.println(("real"));
|
||||
System.out.println(entrepreneur);
|
||||
// System.out.println(entrepreneur.getProjectProposed());
|
||||
// System.out.println(entrepreneur.getProjectParticipation());
|
||||
sectionCellService.addNewSectionCell(
|
||||
new SectionCell(
|
||||
null,
|
||||
2L,
|
||||
"contenu très intéressant",
|
||||
LocalDateTime.now(),
|
||||
projectService.getProjectByName("Project")));
|
||||
sectionCells =
|
||||
sectionCellService.getSectionCellsByProject(
|
||||
projectService.getProjectByName("Project"), 2L);
|
||||
null, 2L, "contenu très intéressant", LocalDateTime.now(), project));
|
||||
sectionCells = sectionCellService.getSectionCellsByProject(project, 2L);
|
||||
}
|
||||
|
||||
private <T> List<T> IterableToList(Iterable<T> iterable) {
|
||||
@ -84,7 +87,6 @@ public class EntrepreneurApiServiceTest {
|
||||
|
||||
@Test
|
||||
void editValidSectionCell() {
|
||||
System.out.println(sectionCells);
|
||||
entrepreneurApiService.editSectionCell(
|
||||
IterableToList(sectionCells).getFirst().getIdSectionCell(),
|
||||
"modified content",
|
||||
@ -122,25 +124,13 @@ public class EntrepreneurApiServiceTest {
|
||||
SectionCell tmpCell =
|
||||
sectionCellService.addNewSectionCell(
|
||||
new SectionCell(
|
||||
null,
|
||||
2L,
|
||||
"contenu temporaire",
|
||||
LocalDateTime.now(),
|
||||
projectService.getProjectByName("Project")));
|
||||
null, 2L, "contenu temporaire", LocalDateTime.now(), project));
|
||||
assertEquals(
|
||||
2,
|
||||
IterableToList(
|
||||
sectionCellService.getSectionCellsByProject(
|
||||
projectService.getProjectByName("Project"), 2L))
|
||||
.size());
|
||||
2, IterableToList(sectionCellService.getSectionCellsByProject(project, 2L)).size());
|
||||
entrepreneurApiService.removeSectionCell(
|
||||
tmpCell.getIdSectionCell(), "entrepreneur@mail.fr");
|
||||
assertEquals(
|
||||
1,
|
||||
IterableToList(
|
||||
sectionCellService.getSectionCellsByProject(
|
||||
projectService.getProjectByName("Project"), 2L))
|
||||
.size());
|
||||
1, IterableToList(sectionCellService.getSectionCellsByProject(project, 2L)).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user