ActorSystem { @Deprecated public static void register(@NonNull Object actor, @NonNull final Scheduler observeOn, @NonNull final Consumer<Message> onMessageReceived) { implementation.register(actor, observeOn, onMessageReceived); } private  ActorSystem(); static MessageBuilder createMessage(int id); static void send(int messageId, @NonNull Class<?>... actorsAddresses); static void send(final Message message, @NonNull Class<?>... actorsAddresses); static void send(int messageId, @NonNull String... actorsClassNames); static void send(final Message message, @NonNull String... actorsClassNames); @Deprecated static void register(@NonNull Object actor,
                                @NonNull final Scheduler observeOn,
                                @NonNull final Consumer<Message> onMessageReceived); static void register(@NonNull final Actor actor); @Deprecated static void register(@NonNull Object actor, @NonNull Consumer<MailboxBuilder> mailboxBuilder); static void postpone(@NonNull Object actor); static void unregister(@NonNull Object actor);  }
@Test public void registerActorAndDisposableThroughRegisterWithConsumer() throws Exception { ActorSystemInstance actorSystem = ActorSystemInstance .getInstance("registerActorAndDisposableThroughRegisterWithConsumer"); final TestActor actor = new TestActor(); actorSystem.register(TestActor.class, Schedulers.trampoline(), new Consumer<Message>() { @Override public void accept(@NonNull Message message) throws Exception { actor.onMessageReceived(message); } }); assertTrue(actorSystem.getMailboxes().containsKey(TestActor.class).blockingGet() && !actorSystem.getActorsDisposables().get(TestActor.class).blockingFirst().isDisposed()); }
@Test public void registerActorAndDisposableThroughRegisterWithActor() throws Exception { ActorSystemInstance actorSystem = ActorSystemInstance .getInstance("registerActorAndDisposableThroughRegisterWithActor"); final TestActorTwo actor = new TestActorTwo(); actorSystem.register(actor); assertTrue(actorSystem.getMailboxes().containsKey(TestActorTwo.class).blockingGet() && !actorSystem.getActorsDisposables().get(TestActorTwo.class).blockingFirst().isDisposed()); }