How to use `BehaviorTestKit` for a typed actor which creates an `ActorMaterializer`?


(Heiko Seeberger) #1

Example:

Behaviors.setup { context =>
  implicit val mat: Materializer    = ActorMaterializer()(context.system)
  ???

Don’t say “not at all” ;-)


(Patrik Nordwall) #2

I guess it fails already when creating the materializer (system.systemActorOf). We should probably have a clear error message for such things that are not supported by BehaviorTestKit.

It’s only a narrow set of tests that can be written with BehaviorTestKit. See them as unit tests of Behaviors. As with all unit tests some things must be stubbed instead of the real thing.


(Heiko Seeberger) #3

Yeah, but for stubbing/mocking these things need to be interfaces: for Materializer that works easily, but not for the extensions like CoordinatedShutdown, Http, etc. See my other questions, tickets …


(Patrik Nordwall) #4

I have started a PR to support extensions and stubbing/mocking of those in BehaviorTestKit: https://github.com/akka/akka/pull/24878