TypeSafe-Activator的ScalaTest值不是String的成员



我正在尝试运行我克隆的项目的测试。我是Scala和Activator的新手,我不知道发生了什么

在根目录下我有build.sbt

name := "xxxxx"
version := "2.0-SNAPSHOT"
scalaVersion := "2.11.5"
doc in Compile <<= target.map(_ / "none")
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
  "json-module" %% "json-module" % "2.0.0",
  )
instrumentSettings
ScoverageKeys.excludedPackages in ScoverageCompile := "<empty>;views*;views.*;views*html;Routes*;controllers*routes*;controllers*Reverse*;controllers*javascript*;controller*ref*"
ScoverageKeys.highlighting := true

这是一个示例文件

class TestExampleSpec extends AbstractSpec {
  "TestExample#get(:testId)" must {
    val url = controllers.routes.TestExample.get(1, 1, 10).url
    "return 400 without X-Client-Id header" in {
      val fakeRequest = FakeRequest("GET", url).withTextBody("")
      val result: Future[Result] = controllers.TestExample.get(1, 1, 10)(fakeRequest)
      status(result) mustBe 400
      contentType(result) mustBe Some("application/json")
      val body = contentAsString(result)
      val bodyJson = Json.parse(body)
      (bodyJson  "error").asOpt[Boolean] mustBe Some(true)
      (bodyJson  "message").asOpt[String] mustBe Some("Missing X-Client-Id header")
    }

我试过这个命令

$ activator reload
$ activator clean
$ activator test

但是这些都不起作用,我收到这样的消息

home/username/code/testing-project/test/TestExampleSpec.scala:10: value in is not a member of String
  "return 400 without X-Client-Id header" in {

谢谢

我认为这个问题与项目从play 2.2更改为play 2.3.8有关

我添加了这个依赖

"org.scalatestplus" %% "play" % "1.2.0" % "test"

似乎奏效了

最新更新