@@ -8,95 +8,98 @@ import no.ssb.kostra.validation.report.Severity
88import no.ssb.kostra.validation.rule.ForAllRowItem
99import no.ssb.kostra.validation.rule.KostraTestFactory
1010
11- class Rule127SummeringInvesteringOsloInternDifferanseTest : BehaviorSpec ({
12- include(
13- KostraTestFactory .validationRuleNoArgsTest(
14- sut = Rule127SummeringInvesteringOsloInternDifferanse (),
15- expectedSeverity = Severity .ERROR ,
16- ForAllRowItem (
17- "All good",
18- listOf(
19- kostraRecordInTest("030100", "0A", 0, 298, 100),
20- kostraRecordInTest("030100", "0A", 0, 798, -100)
11+ class Rule127SummeringInvesteringOsloInternDifferanseTest :
12+ BehaviorSpec ({
13+ include(
14+ KostraTestFactory .validationRuleNoArgsTest(
15+ sut = Rule127SummeringInvesteringOsloInternDifferanse (),
16+ expectedSeverity = Severity .ERROR ,
17+ ForAllRowItem (
18+ " All good" ,
19+ listOf (
20+ kostraRecordInTest(" 030101" , " 0A" , 0 , 298 , 100 ),
21+ kostraRecordInTest(" 030101" , " 0A" , 0 , 798 , - 100 ),
22+ ),
2123 ),
22- ),
23- ForAllRowItem (
24- "region is not Oslo , isOsloInternRegnskap is false",
25- listOf(
26- kostraRecordInTest("XXXXXX ", "0A", 0, 298, 100),
27- kostraRecordInTest(" XXXXXX ", "0A", 0, 798, -100)
24+ ForAllRowItem (
25+ " region is not Oslo, isOsloBydel is false " ,
26+ listOf (
27+ kostraRecordInTest( " XXXXXX " , " 0A " , 0 , 298 , 100 ),
28+ kostraRecordInTest(" XXXXXX" , " 0A" , 0 , 798 , - 100 ),
29+ ),
2830 ),
29- ),
30- ForAllRowItem (
31- "skjema not in 0A or 0M, isOsloInternRegnskap is false",
32- listOf(
33- kostraRecordInTest("030100 ", "XX ", 0, 298, 100),
34- kostraRecordInTest("030100", " XX ", 0, 798, -100)
31+ ForAllRowItem (
32+ " skjema not in 0A or 0M, isOsloBydel is false " ,
33+ listOf (
34+ kostraRecordInTest( " 030101 " , " XX " , 0 , 298 , 100 ),
35+ kostraRecordInTest(" 030101 " , " XX" , 0 , 798 , - 100 ),
36+ ),
3537 ),
36- ),
37- ForAllRowItem (
38- "kontoklasse is not investering",
39- listOf(
40- kostraRecordInTest("030100 ", "0A", 1, 298, 100),
41- kostraRecordInTest("030100", "0A", 1, 798, -100)
38+ ForAllRowItem (
39+ " kontoklasse is not investering " ,
40+ listOf (
41+ kostraRecordInTest( " 030101 " , " 0A " , 1 , 298 , 100 ),
42+ kostraRecordInTest(" 030101 " , " 0A" , 1 , 798 , - 100 ),
43+ ),
4244 ),
43- ),
44- ForAllRowItem (
45- "art not in 298 or 798",
46- listOf(
47- kostraRecordInTest("030100 ", "0A", 0, 100, 100),
48- kostraRecordInTest("030100", "0A", 0, 100, -100)
45+ ForAllRowItem (
46+ " art not in 298 or 798 " ,
47+ listOf (
48+ kostraRecordInTest( " 030101 " , " 0A " , 0 , 100 , 100 ),
49+ kostraRecordInTest(" 030101 " , " 0A" , 0 , 100 , - 100 ),
50+ ),
4951 ),
50- ),
51- ForAllRowItem (
52- "sum of belop is -10",
53- listOf(
54- kostraRecordInTest("030100 ", "0A", 0, 298, 100 ),
55- kostraRecordInTest("030100", "0A", 0, 798, -110)
52+ ForAllRowItem (
53+ " sum of belop is -10 " ,
54+ listOf (
55+ kostraRecordInTest( " 030101 " , " 0A " , 0 , 298 , 100 ),
56+ kostraRecordInTest(" 030101 " , " 0A" , 0 , 798 , - 110 ),
57+ ),
5658 ),
57- ),
58- ForAllRowItem (
59- "sum of belop is 10",
60- listOf(
61- kostraRecordInTest("030100 ", "0A", 0, 298, 110 ),
62- kostraRecordInTest("030100", "0A", 0, 798, -100)
59+ ForAllRowItem (
60+ " sum of belop is 10 " ,
61+ listOf (
62+ kostraRecordInTest( " 030101 " , " 0A " , 0 , 298 , 110 ),
63+ kostraRecordInTest(" 030101 " , " 0A" , 0 , 798 , - 100 ),
64+ ),
6365 ),
64- ),
65- ForAllRowItem (
66- "sum of belop is -11",
67- listOf(
68- kostraRecordInTest("030100", "0A", 0, 298, 100),
69- kostraRecordInTest("030100", "0A", 0, 798, -111)
66+ ForAllRowItem (
67+ " sum of belop is -11" ,
68+ listOf (
69+ kostraRecordInTest(" 030101" , " 0A" , 0 , 298 , 100 ),
70+ kostraRecordInTest(" 030101" , " 0A" , 0 , 798 , - 111 ),
71+ ),
72+ expectedErrorMessage =
73+ " Korrigér differansen (-11) mellom sum over alle funksjoner for art 298 " +
74+ " (100) og sum over alle funksjoner for art 798 (-111) i investeringsregnskapet." ,
7075 ),
71- expectedErrorMessage = "Korrig ér differansen (-11) mellom sum over alle funksjoner for art 298 " +
72- "(100) og sum over alle funksjoner for art 798 (-111) i investeringsregnskapet."
73- ),
74- ForAllRowItem (
75- "sum of belop is 11",
76- listOf(
77- kostraRecordInTest("030100", "0A", 0, 298, 111),
78- kostraRecordInTest("030100", "0A", 0, 798, -100)
76+ ForAllRowItem (
77+ " sum of belop is 11" ,
78+ listOf (
79+ kostraRecordInTest(" 030101" , " 0A" , 0 , 298 , 111 ),
80+ kostraRecordInTest(" 030101" , " 0A" , 0 , 798 , - 100 ),
81+ ),
82+ expectedErrorMessage =
83+ " Korrigér differansen (11) mellom sum over alle funksjoner for art 298 " +
84+ " (111) og sum over alle funksjoner for art 798 (-100) i investeringsregnskapet." ,
7985 ),
80- expectedErrorMessage = "Korrig ér differansen (11) mellom sum over alle funksjoner for art 298 " +
81- "(111) og sum over alle funksjoner for art 798 (-100) i investeringsregnskapet."
82- )
86+ ),
8387 )
84- )
85- }) {
88+ }) {
8689 companion object {
8790 private fun kostraRecordInTest (
8891 region : String ,
8992 skjema : String ,
9093 kontoklasse : Int ,
9194 art : Int ,
92- belop : Int
95+ belop : Int ,
9396 ) = mapOf (
9497 RegnskapConstants .FIELD_REGION to region,
9598 RegnskapConstants .FIELD_SKJEMA to skjema,
9699 RegnskapConstants .FIELD_KONTOKLASSE to " $kontoklasse " ,
97100 RegnskapConstants .FIELD_FUNKSJON to " 100" ,
98101 RegnskapConstants .FIELD_ART to " $art " ,
99- RegnskapConstants .FIELD_BELOP to " $belop "
102+ RegnskapConstants .FIELD_BELOP to " $belop " ,
100103 ).toKostraRecord(1 , RegnskapFieldDefinitions .fieldDefinitions)
101104 }
102- }
105+ }
0 commit comments