-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatisk inntektsendring skal bli manuell etter underkjent fra atte…
…stering (#6585) * Automatisk inntektsendring skal bli manuell etter underkjent fra attestering * Unittest
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
apps/etterlatte-behandling/src/test/kotlin/behandling/BehandlingStatusServiceImplTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package behandling | ||
|
||
import io.mockk.every | ||
import io.mockk.just | ||
import io.mockk.mockk | ||
import io.mockk.runs | ||
import io.mockk.verify | ||
import no.nav.etterlatte.behandling.BehandlingDao | ||
import no.nav.etterlatte.behandling.BehandlingService | ||
import no.nav.etterlatte.behandling.BehandlingStatusServiceImpl | ||
import no.nav.etterlatte.behandling.behandlinginfo.BehandlingInfoDao | ||
import no.nav.etterlatte.behandling.domain.AutomatiskRevurdering | ||
import no.nav.etterlatte.behandling.generellbehandling.GenerellBehandlingService | ||
import no.nav.etterlatte.grunnlagsendring.GrunnlagsendringshendelseService | ||
import no.nav.etterlatte.libs.common.Vedtaksloesning | ||
import no.nav.etterlatte.libs.common.behandling.BehandlingStatus | ||
import no.nav.etterlatte.libs.common.behandling.Prosesstype | ||
import no.nav.etterlatte.libs.common.behandling.Revurderingaarsak | ||
import no.nav.etterlatte.libs.common.oppgave.SakIdOgReferanse | ||
import no.nav.etterlatte.libs.common.oppgave.VedtakEndringDTO | ||
import no.nav.etterlatte.libs.common.sak.SakId | ||
import no.nav.etterlatte.libs.common.tidspunkt.Tidspunkt | ||
import no.nav.etterlatte.libs.common.vedtak.VedtakType | ||
import no.nav.etterlatte.oppgave.OppgaveService | ||
import no.nav.etterlatte.vedtaksvurdering.VedtakHendelse | ||
import org.junit.jupiter.api.Test | ||
import java.time.LocalDateTime | ||
import java.util.UUID | ||
|
||
class BehandlingStatusServiceImplTest { | ||
private val behandlingDao: BehandlingDao = mockk() | ||
private val behandlingService: BehandlingService = mockk() | ||
private val behandlingInfoDao: BehandlingInfoDao = mockk() | ||
private val oppgaveService: OppgaveService = mockk() | ||
private val grunnlagsendringshendelseService: GrunnlagsendringshendelseService = mockk() | ||
private val generellBehandlingService: GenerellBehandlingService = mockk() | ||
|
||
val service = | ||
BehandlingStatusServiceImpl( | ||
behandlingDao, | ||
behandlingService, | ||
behandlingInfoDao, | ||
oppgaveService, | ||
grunnlagsendringshendelseService, | ||
generellBehandlingService, | ||
) | ||
|
||
@Test | ||
fun `Revurdering av type inntektsendring som er automatisk skal flyttes til manuell prosess hvis underkjent attestering`() { | ||
val revurdering = | ||
AutomatiskRevurdering( | ||
id = UUID.randomUUID(), | ||
sak = mockk(), | ||
behandlingOpprettet = LocalDateTime.now(), | ||
status = BehandlingStatus.FATTET_VEDTAK, | ||
kommerBarnetTilgode = null, | ||
virkningstidspunkt = null, | ||
boddEllerArbeidetUtlandet = null, | ||
soeknadMottattDato = null, | ||
revurderingsaarsak = Revurderingaarsak.INNTEKTSENDRING, | ||
revurderingInfo = null, | ||
kilde = Vedtaksloesning.GJENNY, | ||
begrunnelse = "", | ||
relatertBehandlingId = null, | ||
opphoerFraOgMed = null, | ||
tidligereFamiliepleier = null, | ||
sendeBrev = true, | ||
sistEndret = LocalDateTime.now(), | ||
utlandstilknytning = null, | ||
) | ||
val vedtaksendring = | ||
VedtakEndringDTO( | ||
sakIdOgReferanse = SakIdOgReferanse(SakId(123L), ""), | ||
vedtakHendelse = VedtakHendelse(123L, Tidspunkt.now(), null, null, null), | ||
vedtakType = VedtakType.ENDRING, | ||
) | ||
|
||
every { behandlingDao.lagreStatus(any(), any(), any()) } just runs | ||
every { behandlingService.registrerVedtakHendelse(any(), any(), any()) } just runs | ||
every { oppgaveService.tilUnderkjent(any(), any(), any()) } returns mockk() | ||
every { behandlingService.endreProsesstype(any(), any()) } just runs | ||
|
||
service.settReturnertVedtak(revurdering, vedtaksendring) | ||
|
||
verify { behandlingService.endreProsesstype(revurdering.id, Prosesstype.MANUELL) } | ||
} | ||
} |