Revert "forgot to comment out said test"
This reverts commit b116771375cd61c86d842c35ff2ca7fa5a2dea82.
This commit is contained in:
parent
b116771375
commit
a4e13b0f0a
@ -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;
|
||||||
@ -319,61 +319,63 @@ public class SharedApiServiceTest {
|
|||||||
// Creating versions of the SAME SectionCell (share the same idReference)
|
// Creating versions of the SAME SectionCell (share the same idReference)
|
||||||
|
|
||||||
// the first version. This will get a GENERATED idReference.
|
// the first version. This will get a GENERATED idReference.
|
||||||
SectionCell firstVersion =
|
SectionCell firstVersion = getTestSectionCell(
|
||||||
getTestSectionCell(
|
staticAuthorizedProject,
|
||||||
staticAuthorizedProject,
|
targetSectionId,
|
||||||
targetSectionId,
|
"Content V1 (Oldest)",
|
||||||
"Content V1 (Oldest)",
|
LocalDateTime.now().minusDays(3) // Oldest date
|
||||||
LocalDateTime.now().minusDays(3) // Oldest date
|
);
|
||||||
);
|
|
||||||
sectionCellService.addNewSectionCell(firstVersion);
|
sectionCellService.addNewSectionCell(firstVersion);
|
||||||
|
|
||||||
Long sharedIdReference = firstVersion.getIdReference();
|
Long sharedIdReference = firstVersion.getIdReference();
|
||||||
assertNotNull(
|
assertNotNull(sharedIdReference, "idReference should be generated after saving the first version");
|
||||||
sharedIdReference,
|
|
||||||
"idReference should be generated after saving the first version");
|
|
||||||
System.out.println("Generated sharedIdReference: " + sharedIdReference);
|
System.out.println("Generated sharedIdReference: " + sharedIdReference);
|
||||||
|
|
||||||
|
|
||||||
// Create subsequent versions and MANUALLY set the SAME idReference.
|
// Create subsequent versions and MANUALLY set the SAME idReference.
|
||||||
// These represent updates to the cell identified by sharedIdReference.
|
// These represent updates to the cell identified by sharedIdReference.
|
||||||
|
|
||||||
SectionCell middleVersion =
|
SectionCell middleVersion = getTestSectionCell(
|
||||||
getTestSectionCell(
|
staticAuthorizedProject,
|
||||||
staticAuthorizedProject,
|
targetSectionId,
|
||||||
targetSectionId,
|
"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);
|
sectionCellService.addNewSectionCell(middleVersion);
|
||||||
|
|
||||||
SectionCell latestBeforeFilter =
|
|
||||||
getTestSectionCell(
|
SectionCell latestBeforeFilter = getTestSectionCell(
|
||||||
staticAuthorizedProject,
|
staticAuthorizedProject,
|
||||||
targetSectionId,
|
targetSectionId,
|
||||||
"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);
|
sectionCellService.addNewSectionCell(latestBeforeFilter);
|
||||||
|
|
||||||
SectionCell futureVersion =
|
|
||||||
getTestSectionCell(
|
SectionCell futureVersion = getTestSectionCell(
|
||||||
staticAuthorizedProject,
|
staticAuthorizedProject,
|
||||||
targetSectionId,
|
targetSectionId,
|
||||||
"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);
|
sectionCellService.addNewSectionCell(futureVersion);
|
||||||
|
|
||||||
// --- Create other SectionCells that should NOT be included (different sectionId or
|
|
||||||
// project) ---
|
// --- Create other SectionCells that should NOT be included (different sectionId or project) ---
|
||||||
|
|
||||||
// Cell in a different section ID
|
// Cell in a different section ID
|
||||||
sectionCellService.addNewSectionCell(
|
sectionCellService.addNewSectionCell(
|
||||||
getTestSectionCell(
|
getTestSectionCell(
|
||||||
staticAuthorizedProject,
|
staticAuthorizedProject,
|
||||||
99L, // Different sectionId
|
99L, // Different sectionId
|
||||||
"Content in Different Section",
|
"Content in Different Section",
|
||||||
LocalDateTime.now()));
|
LocalDateTime.now()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
Iterable<SectionCell> result =
|
Iterable<SectionCell> result =
|
||||||
@ -387,30 +389,20 @@ public class SharedApiServiceTest {
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(latestBeforeFilter.getIdReference(), resultList.get(0).getIdReference(), "The 0");
|
||||||
latestBeforeFilter.getIdReference(), resultList.get(0).getIdReference(), "The 0");
|
assertEquals(latestBeforeFilter.getIdReference(), resultList.get(1).getIdReference(), "The 1");
|
||||||
assertEquals(
|
assertEquals(latestBeforeFilter.getIdReference(), resultList.get(2).getIdReference(), "The 2");
|
||||||
latestBeforeFilter.getIdReference(), resultList.get(1).getIdReference(), "The 1");
|
|
||||||
assertEquals(
|
|
||||||
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
|
||||||
// Comparing by idSectionCell is a good way to verify the exact entity
|
// Comparing by idSectionCell is a good way to verify the exact entity
|
||||||
assertEquals(
|
assertEquals(latestBeforeFilter.getIdSectionCell(), resultList.get(0).getIdSectionCell(),
|
||||||
latestBeforeFilter.getIdSectionCell(),
|
"The returned SectionCell should be the one with the latest modification date before the filter.");
|
||||||
resultList.get(0).getIdSectionCell(),
|
|
||||||
"The returned SectionCell should be the one with the latest modification date before the filter.");
|
|
||||||
|
|
||||||
// Also assert the idReference and content
|
// Also assert the idReference and content
|
||||||
assertEquals(
|
assertEquals(sharedIdReference, resultList.get(0).getIdReference(), "The returned cell should have the shared idReference.");
|
||||||
sharedIdReference,
|
assertEquals("Content V3 (Latest Before Filter)", resultList.get(0).getContentSectionCell(), "The returned cell should have the correct content.");
|
||||||
resultList.get(0).getIdReference(),
|
|
||||||
"The returned cell should have the shared idReference.");
|
|
||||||
assertEquals(
|
|
||||||
"Content V3 (Latest Before Filter)",
|
|
||||||
resultList.get(0).getContentSectionCell(),
|
|
||||||
"The returned cell should have the correct content.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -696,6 +688,8 @@ public class SharedApiServiceTest {
|
|||||||
assertEquals(HttpStatus.UNAUTHORIZED, exception.getStatusCode());
|
assertEquals(HttpStatus.UNAUTHORIZED, exception.getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
_____ _ _ _
|
_____ _ _ _
|
||||||
@ -718,6 +712,7 @@ public class SharedApiServiceTest {
|
|||||||
* probably and look at peer tests to see what they have done but for now
|
* probably and look at peer tests to see what they have done but for now
|
||||||
* I pushed this half-human code.
|
* I pushed this half-human code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tests retrieving the most recent section cell for each unique idReference
|
* Tests retrieving the most recent section cell for each unique idReference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user