Skip to content
Snippets Groups Projects
Commit fc0062d3 authored by Jan Zickermann's avatar Jan Zickermann
Browse files

#1 KOP-3106 Filter out null orgIds

parent 18519a0b
No related branches found
No related tags found
2 merge requests!17Resolve "router: NPE bei ZuständigerStelle ohne orgId",!16Änderungen von Dataport
......@@ -28,6 +28,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
......@@ -102,6 +103,7 @@ public class VorgangService {
List<String> getOrganisationsEinheitIds(FormData formData) {
return formData.getZustaendigeStelles().stream()
.map(ZustaendigeStelle::getOrganisationseinheitenId)
.filter(Objects::nonNull)
.toList();
}
......
......@@ -306,6 +306,19 @@ class VorgangServiceTest {
class TestGetOrganisationseinheitIds {
private final FormData preservedFormData = FormDataTestFactory.create();
@DisplayName("should filter out empty")
@Test
void shouldFilterOutEmpty() {
var formDataWithNullOrgId = FormDataTestFactory.createBuilder()
.clearZustaendigeStelles()
.zustaendigeStelles(List.of(ZustaendigeStelleTestFactory.createBuilder().organisationseinheitenId(null).build()))
.build();
var organisationseinheitIds = service.getOrganisationsEinheitIds(formDataWithNullOrgId);
assertThat(organisationseinheitIds).isEmpty();
}
@DisplayName("should return")
@Test
void shouldReturn() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment