-
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
1 parent
04870b3
commit 60591de
Showing
2 changed files
with
46 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
45 changes: 45 additions & 0 deletions
45
kontroller/src/test/kotlin/no/ssb/kostra/validation/rule/regnskap/Rule001RecordLengthTest.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,45 @@ | ||
package no.ssb.kostra.validation.rule.regnskap | ||
|
||
import io.kotest.core.spec.style.BehaviorSpec | ||
import io.kotest.matchers.nulls.shouldBeNull | ||
import io.kotest.matchers.nulls.shouldNotBeNull | ||
import no.ssb.kostra.SharedConstants | ||
import no.ssb.kostra.area.regnskap.RegnskapFieldDefinitions | ||
import no.ssb.kostra.area.sosial.kvalifisering.KvalifiseringColumnNames | ||
import no.ssb.kostra.program.KotlinArguments | ||
import no.ssb.kostra.program.extension.municipalityIdFromRegion | ||
import no.ssb.kostra.validation.report.Severity | ||
import no.ssb.kostra.validation.rule.ForAllRowItem | ||
import no.ssb.kostra.validation.rule.KostraTestFactory | ||
import no.ssb.kostra.validation.rule.Rule001RecordLength | ||
import no.ssb.kostra.validation.rule.RuleTestData | ||
import no.ssb.kostra.validation.rule.sosial.kvalifisering.KvalifiseringTestUtils | ||
import no.ssb.kostra.validation.rule.sosial.kvalifisering.rule.Rule014RegistreringsDato | ||
|
||
class Rule001RecordLengthTest : BehaviorSpec({ | ||
include( | ||
KostraTestFactory.validationRuleNoContextTest( | ||
sut = Rule001RecordLength(recordLength), | ||
expectedSeverity = Severity.ERROR, | ||
ForAllRowItem( | ||
"reportingYear = currentYear, valid date", | ||
listOf("0A20233303600 0248 250 300")), | ||
), | ||
ForAllRowItem( | ||
"5 year diff between reportingYear and regDato", | ||
listOf("ERROR "), | ||
expectedErrorMessage = "Feltet for 'Hvilken dato ble søknaden registrert ved NAV-kontoret?' " + | ||
"med verdien (${"0101${KvalifiseringTestUtils.twoDigitReportingYear - 5}"}) enten mangler utfylling, har ugyldig " + | ||
"dato eller dato som er eldre enn 4 år fra rapporteringsåret (${RuleTestData.argumentsInTest.aargang}). " + | ||
"Feltet er obligatorisk å fylle ut.", | ||
) | ||
)) | ||
|
||
}) { | ||
companion object { | ||
private val expectedRecordLength = 48 | ||
private val recordLength = RegnskapFieldDefinitions.fieldLength | ||
private val errorRecordString = "This record should error" | ||
private val validRecordString = "0A20233303600 0248 250 300" | ||
} | ||
} |