Trying to use table-driven property checks to test invalid argument combinations based on the below example found here under Testing invalid argument combinations (bottom of the page, should
replaced with must
) using ScalaTest 3.0.1, my class extending WordSpec with TableDrivenPropertyChecks with MustMatchers
:
forAll (invalidCombos) { (n: Int, d: Int) =>
evaluating {
new Fraction(n, d)
} must produce [IllegalArgumentException]
}
However, IntelliJ IDEA cannot resolve symbol evaluating
and cannot resolve symbol produce
. Now checking MustMachers documentation in 1.8 I found both evaluating
and produce
, but not in those of 3.0.0 or 3.0.1. The Migrating to 3.0 page says nothing about it. Where did they go and how can I use them in ScalaTest 3?
evaluating
keyword has removed in ScalaTest 3, you need to use an [Exception] should be thrownBy { ... }
to instead evaluating
, like:
an [IllegalArgumentException] should be thrownBy {
new Fraction(n, d)
}