fix(backend): reject whitespace-only person search queries

A query of only spaces previously fell through to findAllWithDocumentCount,
exposing the full person list. Whitespace-only queries now return empty.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-30 12:27:57 +02:00
parent f88371e9af
commit 252881b8d1
2 changed files with 9 additions and 9 deletions

View File

@@ -62,12 +62,9 @@ class PersonServiceTest {
}
@Test
void findAll_returnsAll_whenQueryIsBlank() {
List<PersonSummaryDTO> expected = List.of();
when(personRepository.findAllWithDocumentCount()).thenReturn(expected);
assertThat(personService.findAll(" ")).isEqualTo(expected);
verify(personRepository).findAllWithDocumentCount();
void findAll_returnsEmpty_whenQueryIsWhitespaceOnly() {
assertThat(personService.findAll(" ")).isEmpty();
verify(personRepository, never()).findAllWithDocumentCount();
verify(personRepository, never()).searchWithDocumentCount(any());
}