@Test public void testOnDataTreeChanged() { final LeaderLocationListener listener = mock(LeaderLocationListener.class); doNothing().when(listener).onLeaderLocationChanged(any()); final Props props = RoleChangeListenerActor.props(getSystem().deadLetters(), listener); final ActorRef subject = getSystem().actorOf(props, "testDataTreeChangedChanged"); subject.tell(new LeaderStateChanged("member-1", null, (short) 0), noSender()); verify(listener, timeout(5000)).onLeaderLocationChanged(eq(LeaderLocation.UNKNOWN)); subject.tell(new LeaderStateChanged("member-1", "member-1", (short) 0), noSender()); verify(listener, timeout(5000)).onLeaderLocationChanged(eq(LeaderLocation.LOCAL)); subject.tell(new LeaderStateChanged("member-1", "member-2", (short) 0), noSender()); verify(listener, timeout(5000)).onLeaderLocationChanged(eq(LeaderLocation.REMOTE)); }
public static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener) { return Props.create(RoleChangeListenerActor.class, roleChangeNotifier, listener); }
RoleChangeListenerActor extends AbstractUntypedActor { public static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener) { return Props.create(RoleChangeListenerActor.class, roleChangeNotifier, listener); } }
RoleChangeListenerActor extends AbstractUntypedActor { public static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener) { return Props.create(RoleChangeListenerActor.class, roleChangeNotifier, listener); } private  RoleChangeListenerActor(final ActorRef roleChangeNotifier, final LeaderLocationListener listener); }
RoleChangeListenerActor extends AbstractUntypedActor { public static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener) { return Props.create(RoleChangeListenerActor.class, roleChangeNotifier, listener); } private  RoleChangeListenerActor(final ActorRef roleChangeNotifier, final LeaderLocationListener listener); @Override void preStart(); static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener); }
RoleChangeListenerActor extends AbstractUntypedActor { public static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener) { return Props.create(RoleChangeListenerActor.class, roleChangeNotifier, listener); } private  RoleChangeListenerActor(final ActorRef roleChangeNotifier, final LeaderLocationListener listener); @Override void preStart(); static Props props(final ActorRef roleChangeNotifier, final LeaderLocationListener listener);  }