Scalatest matchers doesn't work with implicit conversion. Example:
"testing" when {
implicit def stringToInt(s:String):Int = 123 //not used
implicit def intToString(i:Int):String = "oneTwoThree" //not used
"implicit" should {
"just work " in {
val s: String = "oneTwoThree"
s should equal (123)
}
}
}
A way to convert String to Int for the purspose of this test is implementing Equality[String].
implicit def stringToIntEquality: Equality[String] = new Equality[String] {
override def areEqual(a: String, b: Any): Boolean = b match {
case bInt: Int => if (bInt == 123) true else false
case _ => false
}
}