我的 build.sbt 文件如下所示
name := "cakepattern"
version := "0.1"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"org.scalamock" %% "scalamock-core" % "3.1.1" % "test",
"org.scalamock" %% "scalamock-scalatest-support" % "3.1.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.0" % "test",
"org.mockito" % "mockito-all" % "1.10.19"
)
我的 scalatest 类如下所示
package services
import config.MockAuthServiceComponent
import dto.{Tweet, User}
import org.scalamock.scalatest.MockFactory
import org.scalatest.{FlatSpec, OneInstancePerTest, Outcome}
import org.scalatest.matchers.MatchResult
import services.impl.DefaultTweetServiceComponent
class DefaultTweetServiceComponentTest extends FlatSpec with MockFactory with OneInstancePerTest{
val tweetServiceComponent = new DefaultTweetServiceComponent with MockAuthServiceComponent {
override val tweetService = DefaultTweetService
}
}
当我尝试执行 sbt test:compile 时出现以下错误
Error:scalac: missing or invalid dependency detected while loading class file 'AbstractMockFactory.class'.
Could not access type NoArgTest in trait org.scalatest.Suite,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'AbstractMockFactory.class' was compiled against an incompatible version of org.scalatest.Suite.
当我取出 MockFactory 时,错误似乎消失了。请帮忙,我错过了什么。
谢谢!