What do I need to import/mixin to make "noException" available in a scalatest?

StackOverflow https://stackoverflow.com/questions/22967985

  •  30-06-2023
  •  | 
  •  

質問

I'd like to write a test of the form noException should be thrownBy myFunc() as described in Using Matchers

I can't figure out what class I need to import to put noException in scope. I'm currently mixing in Flatspec with ShouldMatchers, and I've tried also doing it with Matchers

What am I missing?

In case it matters, I'm using scalatest 1.9.1 with scala 2.9:

scalaVersion := "2.9.3"
[...]
"org.scalatest" %% "scalatest" % "1.9.1" % "test",
役に立ちましたか?

解決

Scalatest 2.0 added thrownBy, and presumably noException came with it. You'll need to upgrade scalatest to a 2.x release, which also means upgrading scala to 2.10+

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top