ActorSystem in ActorContext of BehaviorTestKit fails to register extensions

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?

Loading and running extensions does not work with the BehaviorTestKit, you either have to inject them as a parameter to your behavior and provide a mock of some kind or reach for the async ActorTestKit instead.

Thanks for your help.