ScalaTest 3 中的评估和生产去了哪里?
Where did evaluating and produce go in ScalaTest 3?
尝试使用 table 驱动的 属性 检查以根据以下示例测试无效参数组合 here under Testing invalid argument combinations (bottom of the page, should
replaced with must
) using ScalaTest 3.0.1,我的 class 扩展 WordSpec with TableDrivenPropertyChecks with MustMatchers
:
forAll (invalidCombos) { (n: Int, d: Int) =>
evaluating {
new Fraction(n, d)
} must produce [IllegalArgumentException]
}
但是,IntelliJ IDEA cannot resolve symbol evaluating
和 cannot resolve symbol produce
。现在查看 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 页面中的 MustMachers 文档没有任何说明。它们去了哪里以及我如何在 ScalaTest 3 中使用它们?
evaluating
关键字已在 ScalaTest 3 中删除,您需要使用 an [Exception] should be thrownBy { ... }
代替 evaluating
,例如:
an [IllegalArgumentException] should be thrownBy {
new Fraction(n, d)
}
尝试使用 table 驱动的 属性 检查以根据以下示例测试无效参数组合 here under Testing invalid argument combinations (bottom of the page, should
replaced with must
) using ScalaTest 3.0.1,我的 class 扩展 WordSpec with TableDrivenPropertyChecks with MustMatchers
:
forAll (invalidCombos) { (n: Int, d: Int) =>
evaluating {
new Fraction(n, d)
} must produce [IllegalArgumentException]
}
但是,IntelliJ IDEA cannot resolve symbol evaluating
和 cannot resolve symbol produce
。现在查看 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 页面中的 MustMachers 文档没有任何说明。它们去了哪里以及我如何在 ScalaTest 3 中使用它们?
evaluating
关键字已在 ScalaTest 3 中删除,您需要使用 an [Exception] should be thrownBy { ... }
代替 evaluating
,例如:
an [IllegalArgumentException] should be thrownBy {
new Fraction(n, d)
}