我需要导入/混合什么才能使"noException"在标量测试中可用?



我想编写一个noException should be thrownBy myFunc()形式的测试,如使用匹配器中所述

我不知道需要导入什么类才能将noException放入作用域。我目前在Flatspec with ShouldMatchers中混合,我也尝试过在with Matchers 中混合

我错过了什么?

如果重要的话,我使用scalatest 1.9.1和scala 2.9:

scalaVersion := "2.9.3"
[...]
"org.scalatest" %% "scalatest" % "1.9.1" % "test",

Scalatest 2.0添加了thrownBy,可能noException也随之而来。您需要将Scalatest升级到2.x版本,这也意味着将scala升级到2.10+

最新更新