ForwardingDataTreeChangeListener implements DOMDataTreeChangeListener { @Override public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) { LOG.debug("Sending DataTreeChanged to {}", actor); actor.tell(new DataTreeChanged(changes), sendingActor); } ForwardingDataTreeChangeListener(final ActorSelection actor, @Nullable final ActorRef sendingActor); @Override void onDataTreeChanged(final Collection<DataTreeCandidate> changes); @Override void onInitialData(); @Override String toString();  }
@Test public void testOnDataChanged() { final ActorRef actorRef = getSystem().actorOf(MessageCollectorActor.props()); ForwardingDataTreeChangeListener forwardingListener = new ForwardingDataTreeChangeListener( getSystem().actorSelection(actorRef.path()), ActorRef.noSender()); Collection<DataTreeCandidate> expected = Arrays.asList(Mockito.mock(DataTreeCandidate.class)); forwardingListener.onDataTreeChanged(expected); DataTreeChanged actual = MessageCollectorActor.expectFirstMatching(actorRef, DataTreeChanged.class, 5000); Assert.assertSame(expected, actual.getChanges()); }