我想编写一个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+