fix (kinda) : refactored update of data, still trying to fix bug
Some checks failed
Format / formatting (push) Successful in 6s
Build / build (push) Failing after 39s
CI / build (push) Successful in 11s

from EntrepreneurApiServiceTests (code is a bit messy with prints and comments dw)
This commit is contained in:
Théo Le Lez
2025-04-06 19:22:18 +02:00
parent 9b9cfbdb2e
commit aaa6e46d0c
14 changed files with 327 additions and 59 deletions

View File

@ -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