backend-test #10

Open
piair wants to merge 51 commits from backend-test into main
Showing only changes of commit 6f7fc70c4c - Show all commits

View File

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