From d9a7e1fbd36aba73b14fa5cf969e6c2c8872faa5 Mon Sep 17 00:00:00 2001 From: Klara M Helgemo Date: Fri, 29 Nov 2024 13:26:26 +0100 Subject: [PATCH] Fjerner all kontonummerkode, med unntak av kontonummer i grensesnitt. Co-authored-by: Julie Hill Roa --- .../kontoregister/HentKontoRequestDTO.java | 14 --- .../kontoregister/HentKontoResponseDTO.java | 42 ------- .../client/kontoregister/KontoDTO.java | 24 ---- .../kontoregister/KontoregisterClient.java | 9 -- .../KontoregisterClientImpl.java | 118 ------------------ .../kontoregister/UtenlandskKontoDTO.java | 20 --- .../veilarbperson/config/ClientConfig.java | 7 -- .../controller/v2/PersonV2Controller.java | 14 --- .../service/PersonV2Service.java | 12 +- .../config/ClientTestConfig.java | 43 ------- .../service/PersonV2ServiceTest.java | 4 - .../PersonDataKontoregisterMapperTest.java | 92 -------------- 12 files changed, 7 insertions(+), 392 deletions(-) delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java delete mode 100644 src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java deleted file mode 100644 index cf300ce6..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class HentKontoRequestDTO { - private String kontohaver; -} diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java deleted file mode 100644 index 0fe80ad0..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.http.HttpStatus; - -import java.time.LocalDateTime; -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class HentKontoResponseDTO { - - private String kontohaver; - private String kontonummer; - - private class UtenlandskKontoDTO { - private String banknavn; - private String bankkode; - private String bankLandkode; - private String valutakode; - private String swiftBicKode; - private String bankadresse1; - private String bankadresse2; - private String bankadresse3; - } - - private LocalDateTime gyldigFom; - private LocalDateTime gyldigTom; - private String endretAv; - private String opprettetAv; - - public String getNorskKontonummer() { - return kontonummer; - } - public void setNorskKontonummer(String kontonummer) { - this.kontonummer = kontonummer; - } - -} diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java deleted file mode 100644 index 86986463..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class KontoDTO { - private String kontohaver; - private String kontonummer; - - private UtenlandskKontoDTO utenlandskKontoInfo; - - private LocalDateTime gyldigFom; - private LocalDateTime gyldigTom; - private String endretAv; - private String opprettetAv; -} diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java deleted file mode 100644 index 77151310..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java +++ /dev/null @@ -1,9 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import no.nav.common.health.HealthCheck; - -public interface KontoregisterClient extends HealthCheck { - - HentKontoResponseDTO hentKontonummer(HentKontoRequestDTO kontohaver); - -} \ No newline at end of file diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java deleted file mode 100644 index 35770a09..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - - -import lombok.extern.slf4j.Slf4j; -import no.nav.common.health.HealthCheckResult; -import no.nav.common.health.HealthCheckUtils; -import no.nav.common.rest.client.RestClient; -import no.nav.common.rest.client.RestUtils; -import no.nav.common.utils.UrlUtils; -import no.nav.tjeneste.virksomhet.person.v3.informasjon.Person; -import no.nav.veilarbperson.config.CacheConfig; -import no.nav.veilarbperson.domain.Enhet; -import no.nav.veilarbperson.domain.PersonDataKontoregister; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; - -import java.io.IOException; -import java.util.UUID; -import java.util.function.Supplier; - -import static java.util.Optional.ofNullable; -import static no.nav.common.utils.UrlUtils.joinPaths; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -@Slf4j -public class KontoregisterClientImpl implements KontoregisterClient { - - private final String kontoregisterUrl; - private static final String KONTOREGISTER_API_URL = "/api/system/v1/hent-aktiv-konto"; - - private final Supplier systemUserTokenProvider; - - private final OkHttpClient client; - - public KontoregisterClientImpl(String kontoregisterUrl, Supplier systemUserTokenProvider) { - this.kontoregisterUrl = kontoregisterUrl; - this.systemUserTokenProvider = systemUserTokenProvider; - this.client = RestClient.baseClient(); - } - - @Cacheable(CacheConfig.KONTOREGISTER_CACHE_NAME) - @Override - public HentKontoResponseDTO hentKontonummer(HentKontoRequestDTO kontohaver) { - Request request = new Request.Builder() - .url(UrlUtils.joinPaths(kontoregisterUrl, KONTOREGISTER_API_URL)) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + systemUserTokenProvider.get()) - .header("Nav-Call-Id", UUID.randomUUID().toString()) - .post(RestUtils.toJsonRequestBody(kontohaver)) - .build(); - - try (Response response = client.newCall(request).execute()) { - RestUtils.throwIfNotSuccessful(response); - if (response.code() == HttpStatus.OK.value()) { - return RestUtils.parseJsonResponse(response, HentKontoResponseDTO.class) - .orElseThrow(() -> new IllegalStateException("HentKontonummer uventet feil")); - } else if (response.code() == HttpStatus.NO_CONTENT.value()) { - return new HentKontoResponseDTO(); - } else { - throw new IllegalStateException(String.format("Error code: %s, Message: %s", response.code(), response.message())); - } - - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public HealthCheckResult checkHealth() { - Request request = new Request.Builder() - .url(joinPaths(kontoregisterUrl, "/rest/ping")) - .header(AUTHORIZATION, "Bearer " + systemUserTokenProvider.get()) - .build(); - - return HealthCheckUtils.pingUrl(request, client); - } - - public static class PersonDataMapper { - - public static PersonDataKontoregister tilKontoregisterPerson(Person person) { - return new PersonDataKontoregister().setKontonummer(kanskjeKontonummer(person)); - } - - private static String kanskjeKontonummer(Person person) { - if (person instanceof no.nav.tjeneste.virksomhet.person.v3.informasjon.Bruker) { - no.nav.tjeneste.virksomhet.person.v3.informasjon.Bankkonto bankkonto = - ((no.nav.tjeneste.virksomhet.person.v3.informasjon.Bruker) person).getBankkonto(); - return kanskjeKontonummer(bankkonto); - } - return null; - } - - private static String kanskjeKontonummer(no.nav.tjeneste.virksomhet.person.v3.informasjon.Bankkonto bankkonto) { - if (bankkonto instanceof no.nav.tjeneste.virksomhet.person.v3.informasjon.BankkontoNorge bankkontoNorge) { - return ofNullable(bankkontoNorge.getBankkonto()) - .map(no.nav.tjeneste.virksomhet.person.v3.informasjon.Bankkontonummer::getBankkontonummer) - .orElse(null); - } else if (bankkonto instanceof no.nav.tjeneste.virksomhet.person.v3.informasjon.BankkontoUtland wsBankkontoUtland) { - return ofNullable(wsBankkontoUtland.getBankkontoUtland()) - .map(no.nav.tjeneste.virksomhet.person.v3.informasjon.BankkontonummerUtland::getBankkontonummer) - .orElse(null); - } - return null; - } - } - - public static class Mappers { - public static Enhet fraNorg2Enhet(no.nav.common.client.norg2.Enhet enhet) { - return new Enhet(enhet.getEnhetNr(), enhet.getNavn()); - } - } -} - - diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java deleted file mode 100644 index f960ef82..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class UtenlandskKontoDTO { - private String banknavn; - private String bankkode; - private String bankLandkode; - private String valutakode; - private String swiftBicKode; - private String bankadresse1; - private String bankadresse2; - private String bankadresse3; -} diff --git a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java index fe810f3e..2e2bb421 100644 --- a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java +++ b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java @@ -19,8 +19,6 @@ import no.nav.veilarbperson.client.digdir.DigdirClientImpl; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; import no.nav.veilarbperson.client.kodeverk.KodeverkClientImpl; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.nom.SkjermetClientImpl; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClient; @@ -73,11 +71,6 @@ public PamClient pamClient(EnvironmentProperties properties, AzureAdMachineToMac } - @Bean - public KontoregisterClient kontoregisterClient(EnvironmentProperties properties, MachineToMachineTokenClient tokenClient) { - return new KontoregisterClientImpl(properties.getKontoregisterUrl(), () -> tokenClient.createMachineToMachineToken(properties.getKontoregisterScope())); - } - @Bean public SkjermetClient skjermetClient(EnvironmentProperties properties, AzureAdMachineToMachineTokenClient tokenClient) { return new SkjermetClientImpl(properties.getSkjermedePersonerPipUrl(), diff --git a/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java b/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java index dd318c50..b93a447c 100644 --- a/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java +++ b/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java @@ -4,9 +4,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.kontoregister.HentKontoRequestDTO; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; -import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; import no.nav.veilarbperson.client.regoppslag.RegoppslagClient; import no.nav.veilarbperson.client.regoppslag.RegoppslagResponseDTO; import no.nav.veilarbperson.domain.*; @@ -26,8 +23,6 @@ public class PersonV2Controller { private final AuthService authService; private final RegoppslagClient regoppslagClient; - private final KontoregisterClient kontoregisterClient; - @Deprecated @GetMapping @Operation(summary = "Henter informasjon om en person fra PDL") @@ -83,13 +78,4 @@ public RegoppslagResponseDTO hentPostadresse(@RequestParam("fnr") Fnr fnr) { authService.sjekkLesetilgang(fnr); return regoppslagClient.hentPostadresse(fnr); } - @PostMapping - @Operation(summary = "Henter kontonummer fra Kontoregister") - public HentKontoResponseDTO hentKontonummerFraKontoregister(@RequestParam("kontohaver") HentKontoRequestDTO kontohaver) { - Fnr fnr = new Fnr(kontohaver.getKontohaver()); - authService.stoppHvisEksternBruker(); - authService.sjekkLesetilgang(fnr); - return kontoregisterClient.hentKontonummer(kontohaver); - } - } diff --git a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java index ffa204d7..1ab5be58 100644 --- a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java +++ b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java @@ -25,7 +25,6 @@ import java.util.stream.Stream; import static java.util.Optional.ofNullable; -import static no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl.Mappers.fraNorg2Enhet; import static no.nav.veilarbperson.utils.PersonV2DataMapper.*; import static no.nav.veilarbperson.utils.VergeOgFullmaktDataMapper.*; @@ -81,9 +80,7 @@ public PersonV2Data hentFlettetPerson(PersonFraPdlRequest personFraPdlRequest) { } public void flettInnKontonummer(PersonV2Data person) { - // HentKontoRequestDTO kontohaver = new HentKontoRequestDTO(); - // kontohaver.setKontohaver(person.getFodselsnummer().toString()); - // HentKontoResponseDTO kontoregisterKonto = kontoregisterClient.hentKontonummer(kontohaver); + person.setKontonummer(null); } @@ -182,6 +179,12 @@ private void flettGeografiskEnhet(PersonFraPdlRequest personFraPdlRequest, Perso } } + private Enhet fraNorg2Enhet(no.nav.common.client.norg2.Enhet enhet) { + { + return new Enhet(enhet.getEnhetNr(), enhet.getNavn()); + } + } + public void flettKodeverk(PersonV2Data personV2Data) { Optional postnrIBostedsVegAdr = ofNullable(personV2Data.getBostedsadresse()).map(Bostedsadresse::getVegadresse).map( @@ -363,5 +366,4 @@ public PersonNavnV2 hentNavn(PersonFraPdlRequest personFraPdlRequest) { return PersonV2DataMapper.navnMapper(personNavn.getNavn()); } - } diff --git a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java index 708bedb5..1e3c641a 100644 --- a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java +++ b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java @@ -14,22 +14,14 @@ import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; -import no.nav.veilarbperson.client.kontoregister.HentKontoRequestDTO; -import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClient; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClientImpl; -import no.nav.veilarbperson.client.pam.PamClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.domain.PdlRequest; -import no.nav.veilarbperson.client.representasjon.RepresentasjonClient; import no.nav.veilarbperson.client.veilarboppfolging.UnderOppfolging; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; -import org.mockito.Mockito; import org.springframework.cloud.contract.wiremock.WireMockConfiguration; import org.springframework.cloud.contract.wiremock.WireMockConfigurationCustomizer; import org.springframework.context.annotation.Bean; @@ -130,22 +122,6 @@ public HealthCheckResult checkHealth() { }; } - @Bean - public KontoregisterClient kontoregisterClient() { - return new KontoregisterClient() { - @Override - public HentKontoResponseDTO hentKontonummer(HentKontoRequestDTO kontohaver) { - return new HentKontoResponseDTO(); - } - - @Override - public HealthCheckResult checkHealth() { - return HealthCheckResult.healthy(); - } - }; - } - - @Bean public SkjermetClient skjermetClient() { return new SkjermetClient() { @@ -233,25 +209,6 @@ public HealthCheckResult checkHealth() { }; } - public RepresentasjonClient representasjonClient() { - return Mockito.mock(RepresentasjonClient.class); - } - - @Bean - public PamClient pamClient() { - return new PamClient() { - @Override - public Response hentCvOgJobbprofil(Fnr fnr, boolean erBrukerManuell) { - return null; - } - - @Override - public HealthCheckResult checkHealth() { - return HealthCheckResult.healthy(); - } - }; - } - @Bean public SelfTestChecks selfTestChecks() { return mock(SelfTestChecks.class); diff --git a/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java b/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java index d1c15414..d95347d0 100644 --- a/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java +++ b/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java @@ -6,8 +6,6 @@ import no.nav.common.types.identer.Fnr; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; -import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; @@ -45,7 +43,6 @@ public class PersonV2ServiceTest extends PdlClientTestConfig { private final Norg2Client norg2Client = mock(Norg2Client.class); private final DigdirClient digdirClient = mock(DigdirClient.class); private PdlClient pdlClient; - private final KontoregisterClient kontoregisterClient = mock(KontoregisterClient.class); private final KodeverkService kodeverkService = mock(KodeverkService.class); private final SkjermetClient skjermetClient = mock(SkjermetClient.class); private final AuthService authService = mock(AuthService.class); @@ -64,7 +61,6 @@ public void setup() { pdlClient = getPdlClient(); when(norg2Client.hentTilhorendeEnhet(anyString(), any(), anyBoolean())).thenReturn(new Enhet()); when(digdirClient.hentKontaktInfo(any())).thenReturn(new DigdirKontaktinfo()); - when(kontoregisterClient.hentKontonummer(any())).thenReturn(new HentKontoResponseDTO()); personV2Service = new PersonV2Service( pdlClient, diff --git a/src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java b/src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java deleted file mode 100644 index 287db0e2..00000000 --- a/src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package no.nav.veilarbperson.utils.mappers; - -import no.nav.tjeneste.virksomhet.person.v3.informasjon.*; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl; -import no.nav.veilarbperson.domain.PersonDataKontoregister; -import org.junit.Test; - - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; - -public class PersonDataKontoregisterMapperTest { - - @Test - public void kontonummerMappesDersomBankkontoErNorge() { - final String forventetVerdi = "123456789"; - - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoNorge().withBankkonto(new Bankkontonummer().withBankkontonummer(forventetVerdi)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), is(forventetVerdi)); - } - - @Test - public void kontonummerMappesDersomBankkontoErUtland() { - final String forventetVerdi = "987654321"; - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoUtland().withBankkontoUtland(new BankkontonummerUtland().withBankkontonummer(forventetVerdi)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), is(forventetVerdi)); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontoErNull() { - final Person wsPerson = new Bruker().withBankkonto(null); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoNorge().withBankkonto(null) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerVerdiErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoNorge().withBankkonto(new Bankkontonummer().withBankkontonummer(null)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerUtlandErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoUtland().withBankkontoUtland(null) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerUtlandVerdiErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoUtland().withBankkontoUtland(new BankkontonummerUtland().withBankkontonummer(null)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - -}