gpt4 book ai didi

scala - 在代码中设置 akka TestKit 默认超时

转载 作者:行者123 更新时间:2023-12-04 12:41:10 25 4
gpt4 key购买 nike

TestProbe.expectNoMsg() 设置默认超时的正确方法是什么?在代码中不在配置中?

我知道我可以定义 akka.test.single-expect-default在 application.conf 中,但这适用于我模块中的所有测试。或者类似的东西

ActorSystem(.., ConfigFactory.parseString("{akka.test.single-expect-default = 0}"))

在代码中有效,但我希望能够像这样设置这个超时
implicit val timeout = Timeout(100 millis)

我已经看到引用但没有被识别。

我的测试是
@RunWith(classOf[JUnitRunner])
class MySuite extends path.FunSpec with Matchers {

implicit val system = ActorSystem("MySuite")

val probe = new TestProbe(system)

describe ("timeout") {
println("Waiting..")
probe.expectNoMsg()
println("Waited")
}
}

最佳答案

你想设置

akka.test.single-expect-default

在你的配置中

关于scala - 在代码中设置 akka TestKit 默认超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23499527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com