Skip to content

Commit

Permalink
🐛 Håndterer at gyldigTilOgMed kan være null
Browse files Browse the repository at this point in the history
Co-authored-by: Øyvind Hagen <[email protected]>
  • Loading branch information
MartinMekk and oyvindhagen committed Aug 22, 2024
1 parent 9fdbd73 commit 83b8ef6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import no.nav.helse.rapids_rivers.MessageContext
import no.nav.helse.rapids_rivers.River
import no.nav.helse.rapids_rivers.asLocalDate
import no.nav.helse.rapids_rivers.asLocalDateTime
import no.nav.helse.rapids_rivers.asOptionalLocalDate
import org.slf4j.LoggerFactory
import java.time.LocalDate
import java.util.UUID
Expand Down Expand Up @@ -50,7 +51,7 @@ internal class Fullmaktløsning(
val fullmakt = fullmaktNode.path("fullmakt")
fullmakt.size() > 0 &&
fullmakt["gyldigFraOgMed"].asLocalDate().isSameOrBefore(nå) &&
fullmakt["gyldigTilOgMed"].asLocalDate().isSameOrAfter(nå)
fullmakt["gyldigTilOgMed"].asOptionalLocalDate()?.isSameOrAfter(nå) ?: true
}

val fullmaktløsning =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal object Testmeldingfabrikk {
fun lagFullmaktløsningMedFullmakt(
dselsnummer: String,
fom: LocalDate,
tom: LocalDate
tom: LocalDate?
): String = nyHendelse(
id = UUID.randomUUID(), "behov",
mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FullmaktRiverTest {
testRapid.sendTestMessage(Testmeldingfabrikk.lagFullmaktløsningMedFullmakt(
fnr,
fom = now(),
tom = now()
tom = null
))
verify(exactly = 1) { mediator.løsning(any(), any(), any(), capture(slot), any()) }
assertTrue(slot.captured.harFullmakt)
Expand Down

0 comments on commit 83b8ef6

Please sign in to comment.