didn't use the correct function for seting ids, test fixed
All checks were successful
Format / formatting (push) Successful in 6s
Build / build (push) Successful in 41s
CI / build (push) Successful in 16s

This commit is contained in:
MAILLAL Anas 2025-04-29 18:50:25 +02:00
parent 3d57ecb01a
commit 6f7fc70c4c

View File

@ -309,7 +309,7 @@ public class SharedApiServiceTest {
* when the user is authorized and matching cells exist.
* Verifies that only the correct cells are returned.
*/
/*@Test*/
@Test
// Commenting out failing test
void testGetSectionCells_Authorized_Found() {
Long targetSectionId = 1L;
@ -344,7 +344,9 @@ public class SharedApiServiceTest {
"Content V2 (Middle)",
LocalDateTime.now().minusDays(2), // Middle date, before filter
sharedIdReference);
sectionCellService.addNewSectionCell(middleVersion);
middleVersion = sectionCellService.addNewSectionCell(middleVersion);
sectionCellService.updateSectionCellReferenceId(
middleVersion.getIdSectionCell(), sharedIdReference);
SectionCell latestBeforeFilter =
getTestSectionCell(
@ -353,7 +355,9 @@ public class SharedApiServiceTest {
"Content V3 (Latest Before Filter)",
LocalDateTime.now().minusDays(1), // Latest date before filter
sharedIdReference);
sectionCellService.addNewSectionCell(latestBeforeFilter);
latestBeforeFilter = sectionCellService.addNewSectionCell(latestBeforeFilter);
sectionCellService.updateSectionCellReferenceId(
latestBeforeFilter.getIdSectionCell(), sharedIdReference);
SectionCell futureVersion =
getTestSectionCell(
@ -362,7 +366,9 @@ public class SharedApiServiceTest {
"Content V4 (Future - Should Be Excluded)",
LocalDateTime.now().plusDays(1), // Date is AFTER the filter
sharedIdReference);
sectionCellService.addNewSectionCell(futureVersion);
futureVersion = sectionCellService.addNewSectionCell(futureVersion);
sectionCellService.updateSectionCellReferenceId(
futureVersion.getIdSectionCell(), sharedIdReference);
// --- Create other SectionCells that should NOT be included (different sectionId or
// project) ---
@ -386,13 +392,13 @@ public class SharedApiServiceTest {
List<SectionCell> resultList = TestUtils.toList(result);
// Assert
/*
assertEquals(
latestBeforeFilter.getIdReference(), resultList.get(0).getIdReference(), "The 0");
assertEquals(
latestBeforeFilter.getIdReference(), resultList.get(1).getIdReference(), "The 1");
assertEquals(
latestBeforeFilter.getIdReference(), resultList.get(2).getIdReference(), "The 2");
latestBeforeFilter.getIdReference(), resultList.get(2).getIdReference(), "The 2");*/
assertEquals(1, resultList.size());
// Verify that the returned cell is the 'latestBeforeFilter' cell