我有一个简单的测试代码来检查模拟服务:
runtime.unsafeRun(service.run.forkDaemon)
eventually(Timeout(Span(5, Seconds)), Interval(Span(1, Seconds))) {
verify(someMockResult).create(any[String], any[String])
}
service
回报Task[Done]
。_ 它工作正常,但我也想检查它是否unsafeRun
返回succeed
。我试着这样做:
runtime.unsafeRun(service.run.forkDaemon) shouldBe succeed
或者:
val result = runtime.unsafeRun(service.run.forkDaemon)
eventually(Timeout(Span(5, Seconds)), Interval(Span(1, Seconds))) {
result shouldBe succeed
}
但它不起作用。有什么方法可以检查效果结果是否成功?