带有替代方法的重载方法值路由

时间:2017-09-08 16:31:51

标签: scala playframework-2.0 specs2

我收到方法路线,状态,contentAsJson的错误(重载方法)。有什么想法吗?

import play.api.test._
import play.api.test.Helpers
import play.api.libs.json.Json


class ItemsSpec extends PlaySpecification  {
  "Items controller" should {
    "list items" in new WithApplication {
      route(FakeRequest(controllers.routes.Items.list())) match {
        case Some(response) =>
          status(response) must equalTo (OK)
          contentAsJson(response) must equalTo (Json.arr())
        case None => failure
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

我不确定这里是否重要,但在docs中他们建议进行以下导入:

import play.api.test.Helpers._ 

并且您只导入了import play.api.test.Helpers