Symbol 'type <none>.scalacheck.Shrink' is missing from the classpath

拈花ヽ惹草 提交于 2019-12-23 18:47:22

问题


I have the following ScalaCheck unit test using Mockito:

import org.scalatest.mockito.MockitoSugar
import org.mockito.Mockito.when
import org.scalatest.prop.PropertyChecks
import org.mockito.Mockito.verify

class PlayerTest extends org.scalatest.FunSuite with MockitoSugar with PropertyChecks {

  test("doesn't accept anything but M") {
    val mockIOHandler = mock[IOHandler]
    val name = "me"
    val player = new Player(name)

    when(mockIOHandler.nextLine).thenReturn("m")

    val apiUser = new Player("player1")
    apiUser.chooseHand(mockIOHandler)
    verify(mockIOHandler).write("some value")
  }

}

In my build.sbt I have the following dependencies:

scalaVersion := "2.12.2"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.1"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"

// https://mvnrepository.com/artifact/org.mockito/mockito-core
libraryDependencies += "org.mockito" % "mockito-core" % "1.8.5"

For it, I am getting this error:

Error:(12, 41) Symbol 'type <none>.scalacheck.Shrink' is missing from the classpath.
This symbol is required by 'value org.scalatest.prop.GeneratorDrivenPropertyChecks.shrA'.
Make sure that type Shrink is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'GeneratorDrivenPropertyChecks.class' was compiled against an incompatible version of <none>.scalacheck.
  test("doesn't accept anything but M") {

Any idea what could be wrong?


回答1:


Adding scalacheck did the trick for me

lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.+"
lazy val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.+"


来源:https://stackoverflow.com/questions/43717198/symbol-type-none-scalacheck-shrink-is-missing-from-the-classpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!