use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.
the class BrukerRepositoryTest method skalIkkeFeileOmIngenPersonIdFinnes.
@Test
public void skalIkkeFeileOmIngenPersonIdFinnes() {
Fnr fnr = Fnr.ofValidFnr("99999999999");
Optional<PersonId> result = brukerRepository.retrievePersonidFromFnr(fnr);
assertTrue(result.isEmpty());
}
use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.
the class BrukerRepositoryTest method skalHentePersonIdFraDatabase.
@Test
public void skalHentePersonIdFraDatabase() {
Fnr fnr = Fnr.ofValidFnr("12345678900");
PersonId expectedPersonId = PersonId.of("123456");
insertOppfolgingsbrukerForPersonIdToFnrMapping(fnr, expectedPersonId);
Optional<PersonId> result = brukerRepository.retrievePersonidFromFnr(fnr);
assertTrue(result.isPresent());
assertEquals(expectedPersonId, result.get());
}
use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.
the class BrukerRepositoryTest method skalHenteFnrForPersonIdFraDatabase.
@Test
public void skalHenteFnrForPersonIdFraDatabase() throws Exception {
PersonId personId = PersonId.of("123456");
Fnr expectedFnr = Fnr.ofValidFnr("12345678900");
insertOppfolgingsbrukerForPersonIdToFnrMapping(expectedFnr, personId);
Try<Fnr> result = brukerRepository.retrieveFnrFromPersonid(personId);
assertTrue(result.isSuccess());
assertEquals(expectedFnr, result.get());
}
use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.
the class BrukerService method getPersonIdFromFnr.
public PersonId getPersonIdFromFnr(AktorId aktoerId) {
Fnr fnr = aktorClient.hentFnr(aktoerId);
PersonId nyPersonId = brukerRepository.retrievePersonidFromFnr(fnr).orElseThrow(() -> new NoSuchElementException("Fant ikke personId på aktoer: " + aktoerId));
AktorId nyAktorIdForPersonId = Try.of(() -> aktorClient.hentAktorId(fnr)).get();
updateGjeldeFlaggOgInsertAktoeridPaNyttMapping(aktoerId, nyPersonId, nyAktorIdForPersonId);
return nyPersonId;
}
use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.
the class BrukerServiceTest method skalFinnePersonIdFraDatabase.
@Test
public void skalFinnePersonIdFraDatabase() {
when(aktorClient.hentFnr(any(AktorId.class))).thenReturn(Fnr.ofValidFnr(FNR_FRA_SOAP_TJENESTE));
when(aktorClient.hentAktorId(any(Fnr.class))).thenReturn(AktorId.of(AKTOERID_FRA_SOAP_TJENESTE));
AktorId aktoerId = AktorId.of("111");
PersonId personId = PersonId.of("222");
int updated = insert(db, "AKTOERID_TO_PERSONID").value("PERSONID", personId.toString()).value("AKTOERID", aktoerId.toString()).execute();
assertTrue(updated > 0);
Try<PersonId> result = brukerService.hentPersonidFraAktoerid(aktoerId);
verify(aktorClient, never()).hentFnr(any(AktorId.class));
verify(opensearchIndexerV2, never()).slettDokumenter(any());
assertTrue(result.isSuccess());
assertEquals(personId, result.get());
}
Aggregations