我需要导入/ mixin才能在一个scalatest中提供“noException”?

时间:2014-04-09 16:01:11

标签: scala scalatest

我想按Using Matchers

中所述编写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",

1 个答案:

答案 0 :(得分:1)

Scalatest 2.0添加thrownBy,大概noException附带了它。您需要将scalatest升级到2.x版本,这也意味着将scala升级到2.10 +