File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
main/kotlin/com/egm/stellio/search/service
test/kotlin/com/egm/stellio/search/service Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,15 @@ class QueryService(
3838 queryParams,
3939 accessRightFilter
4040 )
41- if (entitiesIds.isEmpty())
42- return @either Pair <List <JsonLdEntity >, Int > (emptyList(), 0 )
43-
4441 val count = temporalEntityAttributeService.getCountForEntities(
4542 queryParams,
4643 accessRightFilter
4744 ).bind()
4845
46+ // we can have an empty list of entities with a non-zero count (e.g., offset too high)
47+ if (entitiesIds.isEmpty())
48+ return @either Pair <List <JsonLdEntity >, Int > (emptyList(), count)
49+
4950 val entitiesPayloads =
5051 entityPayloadService.retrieve(entitiesIds)
5152 .map { toJsonLdEntity(it, listOf (queryParams.context)) }
Original file line number Diff line number Diff line change @@ -97,14 +97,13 @@ class QueryServiceTests {
9797 @Test
9898 fun `it should return an empty list if no entity matched the query` () = runTest {
9999 coEvery { temporalEntityAttributeService.getForEntities(any(), any()) } returns emptyList()
100+ coEvery { temporalEntityAttributeService.getCountForEntities(any(), any()) } returns 0 .right()
100101
101102 queryService.queryEntities(buildDefaultQueryParams()) { null }
102103 .shouldSucceedWith {
103104 assertEquals(0 , it.second)
104105 assertTrue(it.first.isEmpty())
105106 }
106-
107- coVerify { temporalEntityAttributeService.getCountForEntities(any(), any()) wasNot Called }
108107 }
109108
110109 @Test
You can’t perform that action at this time.
0 commit comments