Created
November 27, 2012 02:44
-
-
Save hgiddens/4152064 to your computer and use it in GitHub Desktop.
Why does this work?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "wtf" in { | |
| trait Consumer { def consume(value: Root): Unit } | |
| sealed trait Root | |
| case class Alpha(s: String) extends Root | |
| case class Beta(s: String) extends Root | |
| val consumer = mock[Consumer] | |
| consumer.consume(Alpha("ss")) | |
| consumer.consume(Beta("ss")) | |
| there was two(consumer).consume(any[Alpha]) // I would expect this to fail but it doesn't. | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to be a Mockito issue. If I replace the specs2 syntactic sugar by some pure Mockito calls the example also passes ok: