akka/akka-core

Error with Akka Typed BehaviorTestKit while using TimerScheduler

Open

#24.686 aperta il 8 mar 2018

Vedi su GitHub
 (3 commenti) (1 reazione) (0 assegnatari)Scala (3547 fork)batch import
1 - triagedhelp wantedt:typed

Metriche repository

Star
 (13.277 star)
Metriche merge PR
 (Merge medio 8g 19h) (10 PR mergiate in 30 g)

Descrizione

Trying to create a BehaviorTestKit using a behavior which spawns a timer within as given below

val behaviorTestKit = BehaviorTestKit(createBehavior)

private def createBehavior(): Behavior[MyMessage] = {
  Behaviors
    .withTimers[MyMessage](
      timerScheduler ⇒
        Behaviors
          .mutable[MyMessage](
            ctx =>
              new MyBehavior(
                ctx,
                timerScheduler,
                someInfo
            )
        )
    )
}

gives the following error:

An exception or error caused a run to abort: no scheduler 
java.lang.UnsupportedOperationException: no scheduler

It will be helpful if some stub implementation of scheduler could be supported like in case of contexts.

Guida contributor