Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1362

ActorSystem in ActorContext of BehaviorTestKit fails to register extensions

$
0
0

@shubhamJ wrote:

We faced an issue while using the BehaviorTestKit, where the ActorSystem which is getting injected in the behavior being tested is not able to register extensions. It fails with exception -

ActorSystemStub cannot register extensions
java.lang.UnsupportedOperationException: ActorSystemStub cannot register extensions

Below is the small replication of our test.

import akka.actor.testkit.typed.javadsl.BehaviorTestKit
import akka.actor.typed.ActorRefResolver
import akka.actor.typed.scaladsl.Behaviors
import org.scalatest.funsuite.AnyFunSuite

class SampleTest extends AnyFunSuite {
  private val behavior: Behaviors.Receive[Int] = Behaviors.receive[Int] { (ctx, msg) =>
    val resolver = ActorRefResolver(ctx.system)

    msg match {
      case a => println(a); Behaviors.same
    }
  }

  test("test") {
    BehaviorTestKit.create(behavior).run(1)
  }
}

Is there a way which can solve our problem?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 1362

Trending Articles