scalatest와 scalamock을 처음 사용했습니다. 여기에 내가 여기ScalaMock with scalatest
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"
)
그리고 내 SBT 파일에 그것을 가지고 무엇을 나는 내가 다음과 같은 오류를 얻을 sbt test:compile
을 생각하면
package config
import dto.User
import services.AuthServiceComponent
import org.scalatest.mockito.MockitoSugar._
import services.impl.DefaultUserAuthServiceComponent
trait MockAuthServiceComponent extends AuthServiceComponent{
val x = mock[AuthServiceLike]
type AuthService = x.type
override val userAuthService = x
}
을 조롱하려고하는 클래스이다
[error] missing or invalid dependency detected while loading class file 'MockitoSugar.class'.
[error] Could not access term mockito in package org,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'MockitoSugar.class' was compiled against an incompatible version of org.
[error] missing or invalid dependency detected while loading class file 'MockitoSugar.class'.
[error] Could not access type MockSettings in value org.mockito,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'MockitoSugar.class' was compiled against an incompatible version of org.mockito.
[error] missing or invalid dependency detected while loading class file 'MockitoSugar.class'.
[error] Could not access type Answer in value org.stubbing,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'MockitoSugar.class' was compiled against an incompatible version of org.stubbing.
[error] three errors found
[error] (test:compileIncremental) Compilation failed
내가 무엇이 누락 되었습니까?
[편집]
그래서 내가 전에 가지고 있던 문제가 해결하지만 지금이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.
어떤 제안을 얻을? 당신의 SBT 파일에 Mockito를 추가
mockito의 맨 위에 scalamock이 있습니까? –
질문에서 편집을 참조하십시오 –
아니요, scalamock과 mockito는 서로 다른 두 가지 프로젝트입니다. 테스트 케이스에 두 라이브러리를 모두 포함 시켰는지 이해하지 못했습니다. 나는 당신의 테스트 케이스에서 "import org.scalatest.mockito.MockitoSugar._"라인을 삭제하고, org.mockito "%"mockito-all "%"1.10.19 "% Test"라인을 제거한다고 말하고 싶다. build.sbt 파일을 찾은 다음 다시 시도하십시오. 해당 페이지도 참조하십시오 : http://scalamock.org/user-guide/integration/ –