我最近使用Slick等将我的Play Scala项目更新为2.3.8。
从那时起,我的单元测试使用Wiremock继续失败。
错误显示:
The future returned an exception of type: java.lang.RuntimeException, with message: There is no started application.
如果有任何帮助/建议会很感激吗?
class BlahTest extends FunSuite
with MockitoSugar with ScalaFutures
with SpanSugar with BeforeAndAfter with BeforeAndAfterAll {
val wiremock = new WireMockServer(wireMockConfig().port(1234)
.fileSource(new SingleRootFileSource("test/resources")))
override protected def beforeAll() = wiremock.start()
override protected def afterAll() = wiremock.stop()
before {
Mockito.reset(mockLogger)
configureFor("localhost", 1234)
stubFor(post(urlMatching("/somepath"))
.willReturn(aResponse()
.withStatus(200)))
}
after {
WireMock.reset()
}
test("Some test") {
val f = someObject.method(param1, param2)
whenReady(f, timeout(WiremockTimeout milliseconds)) { answer =>
// verify
}
}