use of no.nav.pto.veilarbportefolje.arenapakafka.ytelser.YtelsesRepositoryV2 in project veilarbportefolje by navikt.
the class YtelserTest method finnLopendeYtelse_skalSetteUtlopsdatoLikNullPaDagpengeytelse.
@Test
public void finnLopendeYtelse_skalSetteUtlopsdatoLikNullPaDagpengeytelse() {
String sak1 = "Sak1";
Timestamp yesterday = Timestamp.valueOf(ZonedDateTime.now().minusDays(1).toLocalDateTime());
Timestamp nextWeek = Timestamp.valueOf(ZonedDateTime.now().plusWeeks(1).toLocalDateTime());
YtelsesRepositoryV2 mockRepositoryV2 = mock(YtelsesRepositoryV2.class);
YtelsesServicePostgres tempYtelsesServicePostgres = new YtelsesServicePostgres(aktorClient, brukerDataService, mockRepositoryV2);
List<YtelseDAO> ytelser = List.of(new YtelseDAO().setSaksId(sak1).setStartDato(yesterday).setUtlopsDato(nextWeek).setType(TypeKafkaYtelse.DAGPENGER));
Mockito.when(mockRepositoryV2.getYtelser(aktorId)).thenReturn(ytelser);
Optional<YtelseDAO> lopendeYtelsePostgres = tempYtelsesServicePostgres.finnLopendeYtelsePostgres(aktorId);
assertThat(lopendeYtelsePostgres.get().getUtlopsDato()).isEqualTo((String) null);
}
Aggregations