Skip to content

Commit 6b5c80b

Browse files
committed
Use AsyncWordSpec to test report generation
1 parent 2c1fcd3 commit 6b5c80b

File tree

1 file changed

+19
-19
lines changed
  • publication/src/test/scala/hmda/publication/reports/disclosure

1 file changed

+19
-19
lines changed

publication/src/test/scala/hmda/publication/reports/disclosure/D51Spec.scala

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import hmda.model.publication.reports.{ EthnicityBorrowerCharacteristic, MSARepo
1111
import hmda.query.model.filing.LoanApplicationRegisterQuery
1212
import hmda.query.repository.filing.LarConverter._
1313
import org.scalacheck.Gen
14-
import org.scalatest.{ MustMatchers, WordSpec }
14+
import org.scalatest.{ AsyncWordSpec, MustMatchers }
1515

16-
import scala.concurrent.{ Await, Future }
17-
import scala.concurrent.duration._
16+
import scala.concurrent.Future
1817

19-
class D51Spec extends WordSpec with MustMatchers with LarGenerators {
18+
class D51Spec extends AsyncWordSpec with MustMatchers with LarGenerators {
2019

2120
implicit val system = ActorSystem()
2221
implicit val ec = system.dispatcher
@@ -40,27 +39,28 @@ class D51Spec extends WordSpec with MustMatchers with LarGenerators {
4039
val expectedDispositions = List(ApplicationReceived, LoansOriginated, ApprovedButNotAccepted, ApplicationsDenied, ApplicationsWithdrawn, ClosedForIncompleteness)
4140

4241
"Generate a Disclosure 5-1 report" in {
43-
val result = Await.result(D51.generate(source, fips, respId, Future("Corvallis Test Bank")), 5.seconds)
42+
D51.generate(source, fips, respId, Future("Corvallis Test Bank")).map { result =>
4443

45-
result.msa mustBe MSAReport("18700", "Corvallis, OR", "OR", "Oregon")
46-
result.table mustBe "5-1"
47-
result.respondentId mustBe "98765"
48-
result.institutionName mustBe "Corvallis Test Bank"
49-
result.applicantIncomes.size mustBe 5
44+
result.msa mustBe MSAReport("18700", "Corvallis, OR", "OR", "Oregon")
45+
result.table mustBe "5-1"
46+
result.respondentId mustBe "98765"
47+
result.institutionName mustBe "Corvallis Test Bank"
48+
result.applicantIncomes.size mustBe 5
5049

51-
val lowestIncome = result.applicantIncomes.head
52-
lowestIncome.applicantIncome mustBe LessThan50PercentOfMSAMedian
50+
val lowestIncome = result.applicantIncomes.head
51+
lowestIncome.applicantIncome mustBe LessThan50PercentOfMSAMedian
5352

54-
val races = lowestIncome.borrowerCharacteristics.head.asInstanceOf[RaceBorrowerCharacteristic].races
55-
races.size mustBe 8
53+
val races = lowestIncome.borrowerCharacteristics.head.asInstanceOf[RaceBorrowerCharacteristic].races
54+
races.size mustBe 8
5655

57-
val ethnicities = lowestIncome.borrowerCharacteristics(1).asInstanceOf[EthnicityBorrowerCharacteristic].ethnicities
58-
ethnicities.size mustBe 4
56+
val ethnicities = lowestIncome.borrowerCharacteristics(1).asInstanceOf[EthnicityBorrowerCharacteristic].ethnicities
57+
ethnicities.size mustBe 4
5958

60-
val minorityStatuses = lowestIncome.borrowerCharacteristics(2).asInstanceOf[MinorityStatusBorrowerCharacteristic].minoritystatus
61-
minorityStatuses.size mustBe 2
59+
val minorityStatuses = lowestIncome.borrowerCharacteristics(2).asInstanceOf[MinorityStatusBorrowerCharacteristic].minoritystatus
60+
minorityStatuses.size mustBe 2
6261

63-
races.head.dispositions.map(_.disposition) mustBe expectedDispositions
62+
races.head.dispositions.map(_.disposition) mustBe expectedDispositions
63+
}
6464
}
6565

6666
}

0 commit comments

Comments
 (0)