我只是尝试写一个这样的简单规范:
"saves the record on create" in {
val request = FakeRequest(POST, "/countries").withJsonBody(Json.parse("""{ "country": {"title":"Germany", "abbreviation":"GER"} }"""))
val create = route(app, request).get
status(create) mustBe OK
contentType(create) mustBe Some("application/json")
contentAsString(create) must include("country")
}
但是在执行时会抛出这样的错误:
java.util.concurrent.RejectedExecutionException: Task slick.backend.DatabaseComponent$DatabaseDef$$anon$2@f456097 rejected from java.util.concurrent.ThreadPoolExecutor@6265d40c[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1]
它适用于get
页面的index
请求测试,任何想法如何解决此问题?
答案 0 :(得分:0)
问题是OneAppPerTest
,因为数据库连接问题:只需将其替换为OneAppPerSuite
即可解决问题