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