test(document): assert non-empty result in receiverSort lazy-loading test

assertThatCode(() -> service.searchDocuments(...)) passed vacuously on an
empty page; capture the result, assert totalElements > 0, then assert
getSender().getLastName() is accessible post-return.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-18 22:21:31 +02:00
parent 050cd0adf8
commit 3356e27273

View File

@@ -119,10 +119,13 @@ class DocumentLazyLoadingTest {
.tags(new HashSet<>(Set.of(tag)))
.build());
assertThatCode(() -> documentService.searchDocuments(
DocumentSearchResult result = documentService.searchDocuments(
null, null, null, null, null, null, null, null,
DocumentSort.RECEIVER, "asc", null,
PageRequest.of(0, 20)))
PageRequest.of(0, 20));
assertThat(result.totalElements()).isGreaterThan(0);
assertThatCode(() ->
result.items().forEach(i -> i.document().getSender().getLastName()))
.doesNotThrowAnyException();
}