Skip to content
Snippets Groups Projects
Commit aefa1977 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6867 OZG-6900 Implement search service

parent bc99ed6e
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ class OrganisationsEinheitSearchService {
}
public List<OrganisationsEinheit> getByOrganisationsEinheitId(String id) {
return List.of();
return repository.findByOrganisationsEinheitId(id);
}
public List<OrganisationsEinheit> search(String text, String ars) {
......
......@@ -64,6 +64,37 @@ class OrganisationsEinheitSearchServiceTest {
}
}
@Nested
class TestGetByOrganisationsEinheitId {
public static final String ORGANISATIONS_EINHEIT_ID = OrganisationsEinheitTestFactory.XZUFI_ID.getId();
private final OrganisationsEinheit organisationsEinheit = OrganisationsEinheitTestFactory.create();
@BeforeEach
void init() {
when(repository.findByOrganisationsEinheitId(ORGANISATIONS_EINHEIT_ID)).thenReturn(List.of(organisationsEinheit));
}
@Test
void shouldFindByOrganisationsEinheitId() {
callService();
verify(repository).findByOrganisationsEinheitId(ORGANISATIONS_EINHEIT_ID);
}
@Test
void shouldReturnOrganisationsEinheiten() {
var result = callService();
assertThat(result).containsExactly(organisationsEinheit);
}
private List<OrganisationsEinheit> callService() {
return service.getByOrganisationsEinheitId(ORGANISATIONS_EINHEIT_ID);
}
}
@Nested
class TestSearch {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment