ActorsInjector { @RestrictTo(RestrictTo.Scope.TESTS) Map<Actor, Set<Object>> getInjectedActorsOwners() { return injectedActorsOwners; } ActorsInjector(ActorSystemInstance actorSystem); @RestrictTo(RestrictTo.Scope.LIBRARY) void clear();  }
@Test public void clearForMultipleActorsThenDoNotUnregisterSpawnedActorWhenTheLastActorIsNotUnregistered() { ActorSystemInstance system = ActorSystemInstance.getInstance("5", configuration()); OwnerOne owner = new OwnerOne(); OwnerTwo ownerTwo = new OwnerTwo(); system.register(ownerTwo); system.register(owner); system.unregister(owner); assertTrue(system.getActorsInjector().getInjectedActorsOwners().size() == 1 && containsOwner(system.getActorsInjector().getInjectedActorsOwners(), ownerTwo)); }
@Test public void clearForMultipleActorsThenUnregisterSpawnedActorWhenTheLastActorUnregisters() { ActorSystemInstance system = ActorSystemInstance.getInstance("5", configuration()); OwnerTwo owner = new OwnerTwo(); OwnerTwo ownerTwo = new OwnerTwo(); system.register(ownerTwo); system.register(owner); system.unregister(owner); system.unregister(ownerTwo); assertTrue(system.getActorsInjector().getInjectedActorsOwners().isEmpty()); }