You need to "adapt" the matcher to become a Matcher[java.util.List[Bar]]
, like this:
import scala.collection.JavaConversions._
class Foo {
def javaList(bars: java.util.List[Int]) = bars
}
val foo = mock[Foo]
foo.javaList(java.util.Arrays.asList(1, 2))
got {
one(foo).javaList(containTheSameElementsAs(Seq(1, 2)) ^^ ((_: java.util.List[Int]).toList))
}
The ((_: java.util.List[Int]).toList)
part transforms the matcher argument so that it has the type expected by the matcher.