Companion object that facilitates the importing of MustMatchersForJUnit
members as
an alternative to mixing it in. One use case is to import MustMatchersForJUnit
members so you can use
them in the Scala interpreter:
Macintosh-65:delus bv$ scala -cp .:../target/jar_contents:junit3.8.2/junit.jar
Welcome to Scala version 2.7.5.final (Java HotSpot(TM) Client VM, Java 1.5.0_16).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import org.scalatest.junit.MustMatchersForJUnit._
import org.scalatest.junit.MustMatchersForJUnit._
scala> "hi" must have length (3)
junit.framework.AssertionFailedError: "hi" did not have length 3
at org.scalatest.junit.MustMatchersForJUnit$class.newTestFailedException(MustMatchersForJUnit.scala:22)
at org.scalatest.junit.MustMatchersForJUnit$.newTestFailedException(MustMatchersForJUnit.scala:63)
at org.scalatest.matchers.Matchers$ResultOfHaveWordForString.length(Matchers.scala:4102)
at .( 1 must equal (2)
junit.framework.AssertionFailedError: 1 did not equal 2
at org.scalatest.junit.MustMatchersForJUnit$class.newTestFailedException(MustMatchersForJUnit.scala:22)
at org.scalatest.junit.MustMatchersForJUnit$.newTestFailedException(MustMatchersForJUnit.scala:63)
at org.scalatest.matchers.MustMatchers$MustMethodHelper$.mustMatcher(MustMatchers.scala:800)
at org.scal...
scala> "hello, world" must startWith ("hello")
scala> 7 must (be >= (3) and not be <= (7))
junit.framework.AssertionFailedError: 7 was greater than or equal to 3, but 7 was less than or equal to 7
at org.scalatest.junit.MustMatchersForJUnit$class.newTestFailedException(MustMatchersForJUnit.scala:22)
at org.scalatest.junit.MustMatchersForJUnit$.newTestFailedException(MustMatchersForJUnit.scala:63)
at org.scalatest.matchers.MustMatchers$MustMethodHelper$.sh...