Trying to test some code that uses Lift's Box, I get an exception:
val x: Box[X] = ...something that returns Failure
x must beNone // Fails with exception
There should be an implicit from Box to Option. And if I do this,
everything works:
val x:Option[X] = ....
x must beNone // Works
Any hints?
/Jeppe
Seems to be something with Mockito:
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import org.specs2.mutable._
import org.specs2.mutable._
scala> import org.specs2.mock._
import org.specs2.mock._
scala> import net.liftweb.common._
import net.liftweb.common._
scala> class Spec extends Specification with Mockito {"test" should {"parse" in { val b:Box[Int] = Full(1); b must beNone}}}
defined class Spec
/Jeppe
For me, the best solution seems to just force conversion to Option. At
least now I know what look out for :-)
/Jeppe