首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >类路径中缺少符号'type <none>.scalacheck.Shrink‘

类路径中缺少符号'type <none>.scalacheck.Shrink‘
EN

Stack Overflow用户
提问于 2017-05-01 17:48:36
回答 1查看 2.6K关注 0票数 4

我使用Mockito进行了以下ScalaCheck单元测试:

代码语言:javascript
运行
复制
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")
  }

}

在我的build.sbt中,我有以下依赖项:

代码语言:javascript
运行
复制
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"

对于它,我得到了这个错误:

代码语言:javascript
运行
复制
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") {

你知道会出什么问题吗?

EN

回答 1

Stack Overflow用户

发布于 2017-05-06 03:26:40

添加scalacheck为我解决了这个问题

代码语言:javascript
运行
复制
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.+"
lazy val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.+"
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43717198

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档