5

私は次の仕様を持っています:

import org.specs2.mock.Mockito
import org.specs2.mutable.Specification

class LinkUserServiceSpec extends Specification with Mockito {

  val linkUserService = mock[LinkUserService]

  "The 'LinkUserService' isUserLinked method" should {
      "return false when a previously unlinked userId is passed in for a given service" in {
          linkUserService.isUserLinked("nobody", "YT") returns false

          linkUserService.isUserLinked("nobody", "YT") must beFalse
      }
  }
}

そして私のbuild.sbtの次の依存関係:

"org.specs2" %% "specs2" % "2.2" % "test"

ただしtest、sbt コンソールに入力すると、次のエラーが表示されます。

[error] bad symbolic reference. A signature in MocksCreation.class refers to type MockSettings
[error] in package org.mockito which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling MocksCreation.class.
[error] bad symbolic reference. A signature in MockitoStubs.class refers to term stubbing
[error] in package org.mockito which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling MockitoStubs.class.
[error] two errors found
[error] (test:compile) Compilation failed
[error] Total time: 3 s, completed Sep 12, 2013 3:23:41 PM

これが何であるか知っている人はいますか?

4

1 に答える 1

7

どうやら Specs2 で Mockito を使用したい場合は、依存関係を自分で提供する必要があるようです。build.sbt に以下を追加すると、動作が開始されました。

"org.mockito" % "mockito-all" % "1.9.5"

于 2013-09-12T20:39:41.740 に答える