Skip to content

Commit 674b755

Browse files
authored
Merge pull request cfpb#1096 from nickgrippin/v463-fix
V463 - logic corrected
2 parents 2a90659 + ee95eab commit 674b755

File tree

2 files changed

+10
-11
lines changed
  • validation/src

2 files changed

+10
-11
lines changed

validation/src/main/scala/hmda/validation/rules/lar/validity/V463.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ object V463 extends EditCheck[LoanApplicationRegister] {
1010
override def name: String = "V463"
1111

1212
override def apply(lar: LoanApplicationRegister): Result = {
13-
when(lar.applicant.coEthnicity is equalTo(5)) {
14-
(lar.applicant.coRace1 is equalTo(8)) and
15-
(lar.applicant.coSex is equalTo(5))
13+
when((lar.applicant.coRace1 is equalTo(8)) or (lar.applicant.coSex is equalTo(5))) {
14+
lar.applicant.coEthnicity is equalTo(5)
1615
}
1716
}
1817
}

validation/src/test/scala/hmda/validation/rules/lar/validity/V463Spec.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import hmda.validation.rules.EditCheck
55
import hmda.validation.rules.lar.LarEditCheckSpec
66

77
class V463Spec extends LarEditCheckSpec {
8-
property("Succeeds when Co-Applicant ethnicity is not 5") {
8+
property("Succeeds when Co-Applicant race != 8 and sex != 5") {
99
forAll(larGen) { lar =>
10-
whenever(lar.applicant.coEthnicity != 5) {
10+
whenever(lar.applicant.coRace1 != 8 && lar.applicant.coSex != 5) {
1111
lar.mustPass
1212
}
1313
}
@@ -21,20 +21,20 @@ class V463Spec extends LarEditCheckSpec {
2121
}
2222
}
2323

24-
property("Fails when Co-Applicant ethnicity=5, race1=8, and sex NOT 5") {
24+
property("Fails when Co-Applicant race1=8, and ethnicity!=5") {
2525
forAll(larGen) { lar =>
26-
whenever(lar.applicant.coSex != 5) {
27-
val invalidApplicant = lar.applicant.copy(coEthnicity = 5, coRace1 = 8)
26+
whenever(lar.applicant.coEthnicity != 5) {
27+
val invalidApplicant = lar.applicant.copy(coRace1 = 8)
2828
val invalidLar = lar.copy(applicant = invalidApplicant)
2929
invalidLar.mustFail
3030
}
3131
}
3232
}
3333

34-
property("Fails whenever Applicant ethnicity=5, sex=5, and coRace1 NOT 8") {
34+
property("Fails whenever Applicant sex=5, and ethnicity!=8") {
3535
forAll(larGen) { lar =>
36-
whenever(lar.applicant.coRace1 != 8) {
37-
val invalidApplicant = lar.applicant.copy(coSex = 5, coEthnicity = 5)
36+
whenever(lar.applicant.coEthnicity != 5) {
37+
val invalidApplicant = lar.applicant.copy(coSex = 5)
3838
val invalidLar = lar.copy(applicant = invalidApplicant)
3939
invalidLar.mustFail
4040
}

0 commit comments

Comments
 (0)