matcher を使用して ScalaMock と ScalaTest でテストを実行しようとしていますshould be
。コードは次のとおりです。
import org.junit.runner.RunWith
import org.scalamock.scalatest.MockFactory
import org.scalatest._
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class ExampleSpec extends FlatSpec with MockFactory with Matchers {
"A turtle" should "say hello!" in {
val m = mock[Pluto]
val turtle = new Turtle(m)
(m.say _).expects(15).returns("ciao 15")
//assert(turtle.ciao === "ciao 15")
turtle.ciao should be ("ciao 15")
}
これは gradle でのインポートです (混合プロジェクト java+scala です):
testCompile 'org.scalamock:scalamock-scalatest-support_2.10:3.0.1',
'junit:junit:4.11',
'de.flapdoodle.embed:de.flapdoodle.embed.mongo:1.42',
"org.hamcrest:hamcrest-core:${hamcrestVersion}",
"org.hamcrest:hamcrest-library:${hamcrestVersion}",
"org.jmock:jmock:${jmockVersion}"
testCompile("org.jmock:jmock-junit4:${jmockVersion}") {
exclude group: "junit"
}
発生しているエラーは次のとおりです。
[ant:scalac] /Users/dierre/IdeaProjects/sitecustomizer/src/test/scala/org/eianni/sitecustomizer/ExampleSpec.scala:20: error: not found: type Matchers
[ant:scalac] class ExampleSpec extends FlatSpec with MockFactory with Matchers {
[ant:scalac] ^
[ant:scalac] /Users/dierre/IdeaProjects/sitecustomizer/src/test/scala/org/eianni/sitecustomizer/ExampleSpec.scala:30: error: not found: value be
[ant:scalac] turtle.ciao should be ("ciao 15")
[ant:scalac] ^
[ant:scalac] two errors found
助けてくれてありがとう。