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:
@@ -119,10 +119,13 @@ class DocumentLazyLoadingTest {
|
|||||||
.tags(new HashSet<>(Set.of(tag)))
|
.tags(new HashSet<>(Set.of(tag)))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
assertThatCode(() -> documentService.searchDocuments(
|
DocumentSearchResult result = documentService.searchDocuments(
|
||||||
null, null, null, null, null, null, null, null,
|
null, null, null, null, null, null, null, null,
|
||||||
DocumentSort.RECEIVER, "asc", 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();
|
.doesNotThrowAnyException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user