-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
342 additions
and
186 deletions.
There are no files selected for viewing
48 changes: 0 additions & 48 deletions
48
...no.nav.helsearbeidsgiver.inntektsmelding.berikinntektsmeldingservice/ForespoerselUtils.kt
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
127 changes: 127 additions & 0 deletions
127
db/src/test/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/db/InntektsmeldingUtilsKtTest.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,127 @@ | ||
package no.nav.helsearbeidsgiver.inntektsmelding.db | ||
|
||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.booleans.shouldBeFalse | ||
import io.kotest.matchers.booleans.shouldBeTrue | ||
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Arbeidsgiverperiode | ||
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Bonus | ||
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Inntekt | ||
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Refusjon | ||
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.til | ||
import no.nav.helsearbeidsgiver.felles.test.mock.mockForespoersel | ||
import no.nav.helsearbeidsgiver.felles.test.mock.mockSkjemaInntektsmelding | ||
import no.nav.helsearbeidsgiver.felles.test.mock.randomDigitString | ||
import no.nav.helsearbeidsgiver.felles.test.mock.utenPaakrevdAGP | ||
import no.nav.helsearbeidsgiver.felles.test.mock.utenPaakrevdInntekt | ||
import no.nav.helsearbeidsgiver.felles.test.mock.utenPaakrevdRefusjon | ||
import no.nav.helsearbeidsgiver.utils.test.date.desember | ||
import no.nav.helsearbeidsgiver.utils.test.date.november | ||
|
||
class InntektsmeldingUtilsKtTest : | ||
FunSpec({ | ||
context("erDuplikatAv") { | ||
context("_ikke_ duplikater") { | ||
test("ulike skjema er _ikke_ duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = mockSkjemaInntektsmelding() | ||
val forespoersel = mockForespoersel() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeFalse() | ||
} | ||
|
||
test("skjema med ulik agp er _ikke_ duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(agp = nyAgp) | ||
val forespoersel = mockForespoersel() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeFalse() | ||
} | ||
|
||
test("skjema med ulik inntekt er _ikke_ duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(inntekt = nyInntekt) | ||
val forespoersel = mockForespoersel() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeFalse() | ||
} | ||
|
||
test("skjema med ulik refusjon er _ikke_ duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(refusjon = nyRefusjon) | ||
val forespoersel = mockForespoersel() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeFalse() | ||
} | ||
} | ||
|
||
context("duplikater") { | ||
test("helt like skjema er duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy() | ||
val forespoersel = mockForespoersel() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeTrue() | ||
} | ||
|
||
test("skjema med ulike avsender-tlf er duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(avsenderTlf = randomDigitString(8)) | ||
val forespoersel = mockForespoersel() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeTrue() | ||
} | ||
|
||
test("skjema med ulik agp når lik agp ikke er påkrevd er duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(agp = nyAgp) | ||
val forespoersel = mockForespoersel().utenPaakrevdAGP() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeTrue() | ||
} | ||
|
||
test("skjema med ulik inntekt når inntekt ikke er påkrevd er duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(inntekt = nyInntekt) | ||
val forespoersel = mockForespoersel().utenPaakrevdInntekt() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeTrue() | ||
} | ||
|
||
test("skjema med ulik refusjon når refusjon ikke er påkrevd er duplikater") { | ||
val gammel = mockSkjemaInntektsmelding() | ||
val ny = gammel.copy(refusjon = nyRefusjon) | ||
val forespoersel = mockForespoersel().utenPaakrevdRefusjon() | ||
|
||
ny.erDuplikatAv(gammel, forespoersel).shouldBeTrue() | ||
} | ||
} | ||
} | ||
}) | ||
|
||
private val nyAgp = | ||
Arbeidsgiverperiode( | ||
perioder = | ||
listOf( | ||
14.desember til 29.desember, | ||
), | ||
egenmeldinger = | ||
listOf( | ||
14.desember til 16.desember, | ||
), | ||
redusertLoennIAgp = null, | ||
) | ||
|
||
private val nyInntekt = | ||
Inntekt( | ||
beloep = 7707.7, | ||
inntektsdato = 30.november, | ||
naturalytelser = emptyList(), | ||
endringAarsak = Bonus, | ||
) | ||
|
||
private val nyRefusjon = | ||
Refusjon( | ||
beloepPerMaaned = 4021.1, | ||
endringer = emptyList(), | ||
sluttdato = 31.desember, | ||
) |
Oops, something went wrong.