akka/akka-core

StubbedActorContext.scheduleOnce returns canceled Cancellable

Open

#28,596 创建于 2020年2月11日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Scala (3,547 fork)batch import
1 - triagedhelp wantedt:testingt:typed

仓库指标

Star
 (13,277 star)
PR 合并指标
 (平均合并 8天 19小时) (30 天内合并 10 个 PR)

描述

The current implementation of StubbedActorContext.scheduleOnce always returns an already canceled Cancellable. This makes it impossible to test any logic that relies on the state of the scheduled event (keeping an existing one vs. creating a new one based on its state).

Since one would expect to succeed in scheduling a new event with StubbedActorContext.scheduleOnce, shouldn't the stub returned be one that is uncancelle and transitions to cancelled if .cancel()` is called? If that change in behavior is acceptable, I'd gladly provide a PR for it.

贡献者指南