【问题标题】:overloaded method value route with alternatives具有替代方案的重载方法值路由
【发布时间】:2018-02-17 15:29:40
【问题描述】:

我在方法路由、状态、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
      }
    }
  }
}

【问题讨论】:

    标签: scala playframework-2.0 specs2


    【解决方案1】:

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

    import play.api.test.Helpers._ 
    

    而你只导入了import play.api.test.Helpers

    【讨论】:

      猜你喜欢
      • 2014-04-19
      • 2020-06-03
      • 1970-01-01
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-05
      • 1970-01-01
      相关资源
      最近更新 更多