feat(person): add findByDisplayNameContaining service method
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,10 @@ public class PersonService {
|
|||||||
return personRepository.findAllById(ids);
|
return personRepository.findAllById(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Person> findByDisplayNameContaining(String fragment) {
|
||||||
|
return personRepository.searchByName(fragment);
|
||||||
|
}
|
||||||
|
|
||||||
public List<Person> findAllFamilyMembers() {
|
public List<Person> findAllFamilyMembers() {
|
||||||
return personRepository.findByFamilyMemberTrueOrderByLastNameAscFirstNameAsc();
|
return personRepository.findByFamilyMemberTrueOrderByLastNameAscFirstNameAsc();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -898,4 +898,15 @@ class PersonServiceTest {
|
|||||||
.extracting(e -> ((DomainException) e).getStatus().value())
|
.extracting(e -> ((DomainException) e).getStatus().value())
|
||||||
.isEqualTo(403);
|
.isEqualTo(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findByDisplayNameContaining_delegatesToSearchByName() {
|
||||||
|
Person walter = Person.builder().id(UUID.randomUUID()).firstName("Walter").lastName("Müller").build();
|
||||||
|
when(personRepository.searchByName("Walter")).thenReturn(List.of(walter));
|
||||||
|
|
||||||
|
List<Person> result = personService.findByDisplayNameContaining("Walter");
|
||||||
|
|
||||||
|
assertThat(result).containsExactly(walter);
|
||||||
|
verify(personRepository).searchByName("Walter");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user