fix: name coherence + test logic
This commit is contained in:
@ -29,7 +29,8 @@ import java.util.List;
|
||||
public class EntrepreneurApiServiceTest {
|
||||
private static Entrepreneur entrepreneur;
|
||||
private static Project project;
|
||||
private static Iterable<SectionCell> sectionCells;
|
||||
private static Iterable<SectionCell> sectionCells2;
|
||||
private static Iterable<SectionCell> sectionCells3;
|
||||
@Autowired private EntrepreneurApiService entrepreneurApiService;
|
||||
@Autowired private EntrepreneurService entrepreneurService;
|
||||
@Autowired private ProjectService projectService;
|
||||
@ -73,10 +74,25 @@ public class EntrepreneurApiServiceTest {
|
||||
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(), project));
|
||||
sectionCells = sectionCellService.getSectionCellsByProject(project, 2L);
|
||||
SectionCell s1 =
|
||||
sectionCellService.addNewSectionCell(
|
||||
new SectionCell(
|
||||
null,
|
||||
2L,
|
||||
"contenu très intéressant",
|
||||
LocalDateTime.now(),
|
||||
project));
|
||||
|
||||
SectionCell s2 =
|
||||
sectionCellService.addNewSectionCell(
|
||||
new SectionCell(
|
||||
null,
|
||||
3L,
|
||||
"contenu très intéressant",
|
||||
LocalDateTime.now(),
|
||||
project));
|
||||
sectionCells2 = sectionCellService.getSectionCellsByProject(project, 2L);
|
||||
sectionCells3 = sectionCellService.getSectionCellsByProject(project, 3L);
|
||||
}
|
||||
|
||||
private <T> List<T> IterableToList(Iterable<T> iterable) {
|
||||
@ -87,17 +103,14 @@ public class EntrepreneurApiServiceTest {
|
||||
|
||||
@Test
|
||||
void editValidSectionCell() {
|
||||
System.out.println("START\n\n\n");
|
||||
entrepreneurApiService.editSectionCell(
|
||||
IterableToList(sectionCells).getFirst().getIdSectionCell(),
|
||||
IterableToList(sectionCells2).getFirst().getIdSectionCell(),
|
||||
"modified content",
|
||||
"entrepreneur@mail.fr");
|
||||
// We get the data from the database again.
|
||||
sectionCells = sectionCellService.getSectionCellsByProject(project, 2L);
|
||||
assertEquals(
|
||||
"modified content",
|
||||
IterableToList(sectionCells).getFirst().getContentSectionCell());
|
||||
System.out.println("END\n\n\n");
|
||||
SectionCell s =
|
||||
IterableToList(sectionCellService.getSectionCellsByProject(project, 2L)).getFirst();
|
||||
assertEquals("modified content", s.getContentSectionCell());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -115,12 +128,13 @@ public class EntrepreneurApiServiceTest {
|
||||
ResponseStatusException.class,
|
||||
() ->
|
||||
entrepreneurApiService.editSectionCell(
|
||||
IterableToList(sectionCells).getFirst().getIdSectionCell(),
|
||||
IterableToList(sectionCells3).getFirst().getIdSectionCell(),
|
||||
"should not be modified",
|
||||
"testentrepreneur@mail.fr"));
|
||||
assertEquals(
|
||||
"contenu très intéressant",
|
||||
IterableToList(sectionCells).getFirst().getContentSectionCell());
|
||||
SectionCell s =
|
||||
IterableToList(sectionCellService.getSectionCellsByProject(project, 3L)).getFirst();
|
||||
|
||||
assertEquals("contenu très intéressant", s.getContentSectionCell());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user