This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
-
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
12 changed files
with
350 additions
and
339 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
18 changes: 0 additions & 18 deletions
18
syfosm-common-diagnosis-codes/src/test/kotlin/no/nav/syfo/sm/DiagnosekodeSpek.kt
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
syfosm-common-diagnosis-codes/src/test/kotlin/no/nav/syfo/sm/DiagnosekodeTest.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,18 @@ | ||
package no.nav.syfo.sm | ||
|
||
import org.amshove.kluent.shouldBeGreaterThan | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class DiagnosekodeTest { | ||
@Test | ||
fun `ICPC2 should be loaded`() { | ||
Diagnosekoder.icpc2.size shouldBeGreaterThan 100 | ||
} | ||
|
||
|
||
@Test | ||
fun `ICD10 should be loaded`() { | ||
Diagnosekoder.icd10.size shouldBeGreaterThan 100 | ||
} | ||
|
||
} |
52 changes: 0 additions & 52 deletions
52
syfosm-common-models/src/test/kotlin/no/nav/syfo/model/ReceivedSykmeldingSpek.kt
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
syfosm-common-models/src/test/kotlin/no/nav/syfo/model/ReceivedSykmeldingTest.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,52 @@ | ||
package no.nav.syfo.model | ||
|
||
import com.fasterxml.jackson.databind.DeserializationFeature | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.databind.SerializationFeature | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import com.fasterxml.jackson.module.kotlin.registerKotlinModule | ||
import org.amshove.kluent.shouldBeEqualTo | ||
import org.amshove.kluent.shouldNotBe | ||
import org.junit.jupiter.api.Test | ||
import java.time.LocalDateTime | ||
import java.time.Month | ||
|
||
internal class ReceivedSykmeldingTest { | ||
val objectMapper = ObjectMapper() | ||
.registerKotlinModule() | ||
.registerModule(JavaTimeModule()) | ||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | ||
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) | ||
|
||
@Test | ||
fun `Maksimal gyldig ReceivedSykmelding skal validere ok`() { | ||
val receivedSykmelding: ReceivedSykmelding = objectMapper.readValue( | ||
ReceivedSykmelding::class.java.getResourceAsStream("/gyldig-receivedsykmelding-maksimal.json") | ||
.readBytes().toString(Charsets.UTF_8) | ||
) | ||
|
||
receivedSykmelding.mottattDato shouldBeEqualTo LocalDateTime.of(2020, Month.JANUARY, 1, 12, 28, 40) | ||
receivedSykmelding.sykmelding.id shouldBeEqualTo "b5e84795-43a8-4adb-ac1d-4b2e1e0c5fb7" | ||
receivedSykmelding.sykmelding.arbeidsgiver shouldBeEqualTo Arbeidsgiver( | ||
harArbeidsgiver = HarArbeidsgiver.EN_ARBEIDSGIVER, | ||
navn = "Min Bedrift", | ||
yrkesbetegnelse = "Konsulent", | ||
stillingsprosent = 100 | ||
) | ||
receivedSykmelding.sykmelding.utdypendeOpplysninger["6.3"] shouldNotBe null | ||
} | ||
|
||
@Test | ||
fun `Minimal gyldig ReceivedSykmelding skal validere ok`() { | ||
val receivedSykmelding: ReceivedSykmelding = objectMapper.readValue( | ||
ReceivedSykmelding::class.java.getResourceAsStream("/gyldig-receivedsykmelding-minimal.json") | ||
.readBytes().toString(Charsets.UTF_8) | ||
) | ||
|
||
receivedSykmelding.msgId shouldBeEqualTo "A24A4DD6-AE61-493B-A0C9-46FD45F859DB" | ||
receivedSykmelding.legekontorOrgNr shouldBeEqualTo null | ||
receivedSykmelding.sykmelding.behandler.etternavn shouldBeEqualTo "Superlege" | ||
receivedSykmelding.sykmelding.kontaktMedPasient.begrunnelseIkkeKontakt shouldBeEqualTo null | ||
} | ||
} |
62 changes: 0 additions & 62 deletions
62
syfosm-common-models/src/test/kotlin/no/nav/syfo/model/ValidationResultSpek.kt
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
syfosm-common-models/src/test/kotlin/no/nav/syfo/model/ValidationResultTest.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,63 @@ | ||
package no.nav.syfo.model | ||
|
||
import com.fasterxml.jackson.databind.DeserializationFeature | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.databind.SerializationFeature | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import com.fasterxml.jackson.module.kotlin.registerKotlinModule | ||
import org.amshove.kluent.shouldBeEqualTo | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class ValidationResultTest { | ||
val objectMapper: ObjectMapper = ObjectMapper() | ||
.registerKotlinModule() | ||
.registerModule(JavaTimeModule()) | ||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | ||
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) | ||
|
||
@Test | ||
fun `Gyldig ValidationResult med resultat OK skal validere ok`() { | ||
val validationResult: ValidationResult = objectMapper.readValue( | ||
ValidationResult::class.java.getResourceAsStream("/gyldig-validationresult-ok.json").readBytes() | ||
.toString(Charsets.UTF_8) | ||
) | ||
|
||
validationResult.status shouldBeEqualTo Status.OK | ||
validationResult.ruleHits.size shouldBeEqualTo 0 | ||
} | ||
|
||
@Test | ||
fun `Gyldig ValidationResult med resultat MANUAL_PROCESSING skal validere ok`() { | ||
val validationResult: ValidationResult = objectMapper.readValue( | ||
ValidationResult::class.java.getResourceAsStream("/gyldig-validationresult-manuell.json").readBytes() | ||
.toString(Charsets.UTF_8) | ||
) | ||
|
||
validationResult.status shouldBeEqualTo Status.MANUAL_PROCESSING | ||
validationResult.ruleHits.size shouldBeEqualTo 1 | ||
validationResult.ruleHits[0] shouldBeEqualTo RuleInfo( | ||
ruleName = "TILBAKEDATERT_MED_BEGRUNNELSE_FORLENGELSE", | ||
messageForSender = "Sykmeldingen er tilbakedatert og felt 11.2 (begrunnelseIkkeKontakt) er utfylt", | ||
messageForUser = "Sykmeldingen er tilbakedatert og årsak for tilbakedatering er angitt", | ||
ruleStatus = Status.MANUAL_PROCESSING | ||
) | ||
} | ||
|
||
@Test | ||
fun `Gyldig ValidationResult med resultat INVALID skal validere ok`() { | ||
val validationResult: ValidationResult = objectMapper.readValue( | ||
ValidationResult::class.java.getResourceAsStream("/gyldig-validationresult-avvist.json").readBytes() | ||
.toString(Charsets.UTF_8) | ||
) | ||
|
||
validationResult.status shouldBeEqualTo Status.INVALID | ||
validationResult.ruleHits.size shouldBeEqualTo 1 | ||
validationResult.ruleHits[0] shouldBeEqualTo RuleInfo( | ||
ruleName = "TILBAKEDATERT_MER_ENN_8_DAGER_FORSTE_SYKMELDING", | ||
messageForSender = "Sykmeldingen kan ikke rettes, det må skrives en ny. Pasienten har fått beskjed om å vente på ny sykmelding fra deg.", | ||
messageForUser = "Sykmeldingen er tilbakedatert uten begrunnelse fra den som sykmeldte deg.", | ||
ruleStatus = Status.INVALID | ||
) | ||
} | ||
} |
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
Oops, something went wrong.