Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Welcome to Scala version 2.11.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_71).
- Type in expressions to have them evaluated.
- Type :help for more information.
- scala> class ID(val id:Long) extends AnyVal
- defined class ID
- scala> import org.specs2.mock.Mockito
- import org.specs2.mock.Mockito
- scala> class Test extends Mockito{
- | val anyID = any[Long].asInstanceOf[ID]
- | }
- defined class Test
- scala> new Test().anyID
- java.lang.ClassCastException: java.lang.Long cannot be cast to ID
- ... 44 elided
- scala> class SID(val id:Long) extends AnyVal
- defined class SID
- scala> class Test2 extends Mockito{
- | val anySID = any[String].asInstanceOf[SID]
- | }
- defined class Test2
- scala> new Test2().anySID
- java.lang.NullPointerException
- ... 44 elided
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement