You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importorg.specs2.matcher.Matcherimportorg.specs2.mock.Mockitoimportorg.specs2.mutable.SpecificationclassArgThatProblemSpecextendsSpecificationwithMockito {
defbeTrueCustom:Matcher[Boolean] = beTrue ^^ {(t: Boolean) => t}
defsomeFun(x: Int):Boolean=truedefsomeFun2(x: Int): (Option[String], Boolean) = (Some("Test"), true)
"ArgThat" should {
"not apply here" in {
someFun(42) must beTrueCustom
someFun2(42) must beTrueCustom
}
}
}
There should be a compile error for the second case as a matcher of Matcher[Boolean] should not match an (Option[String], Boolean). Instead, I get this:
[info] ArgThatProblemSpec
[info]
[info] ArgThat should
[info] ! not apply here
[error] ClassCastException: : java.lang.Boolean cannot be cast to org.specs2.matcher.Matcher (ArgThatProblemSpec.scala:33)
[error] ArgThatProblemSpec$$anonfun$1$$anonfun$apply$2.apply(ArgThatProblemSpec.scala:33)
[error] ArgThatProblemSpec$$anonfun$1$$anonfun$apply$2.apply(ArgThatProblemSpec.scala:31)
[info]
[info]
[info] Total for specification ArgThatProblemSpec
[info] Finished in 45 ms
[info] 1 example, 0 failure, 1 error
Indeed, that is the case when I remove the Mockito mixin:
ArgThatProblemSpec.scala:14: type mismatch;
[error] found : org.specs2.matcher.Matcher[Boolean]
[error] required: org.specs2.matcher.Matcher[(Option[String], Boolean)]
[error] someFun2(42) must beTrueCustom
Apparently the implicit conversion in ArgThat causes this.
One more thing: ArgThat mixin in Mockito seems to be redundant as MockitoMatchers already includes that.
Using Scala 2.10.4 and specs2 2.3.11.
Thanks,
Emre
The text was updated successfully, but these errors were encountered:
Consider the following snippet:
There should be a compile error for the second case as a matcher of
Matcher[Boolean]
should not match an(Option[String], Boolean)
. Instead, I get this:Indeed, that is the case when I remove the Mockito mixin:
Apparently the implicit conversion in ArgThat causes this.
One more thing: ArgThat mixin in Mockito seems to be redundant as MockitoMatchers already includes that.
Using Scala 2.10.4 and specs2 2.3.11.
Thanks,
Emre
The text was updated successfully, but these errors were encountered: