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

Merge branch '1-router-npe-bei-zustandigerstelle-ohne-orgid' into 'develop'

Resolve "router: NPE bei ZuständigerStelle ohne orgId"

See merge request !17
parents 70bd1f70 fc0062d3
No related branches found
No related tags found
1 merge request!17Resolve "router: NPE bei ZuständigerStelle ohne orgId"
......@@ -27,10 +27,12 @@ import java.util.TimeZone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = { "de.ozgcloud" })
@EnableScheduling
@EnableAsync
public class Application {
public static final String ZUFI_MANAGER_GRPC_CLIENT = "zufi-manager";
......
......@@ -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.
Please register or to comment