EntityOwnershipListenerActor extends AbstractUntypedActor { @SuppressWarnings("checkstyle:IllegalCatch") private void onEntityOwnershipChanged(final DOMEntityOwnershipChange change) { LOG.debug("Notifying EntityOwnershipListener {}: {}", listener, change); try { listener.ownershipChanged(change); } catch (Exception e) { LOG.error("Error notifying listener {}", listener, e); } } private  EntityOwnershipListenerActor(final DOMEntityOwnershipListener listener);   }
@Test public void testOnEntityOwnershipChanged() { DOMEntityOwnershipListener mockListener = mock(DOMEntityOwnershipListener.class); TestActorRef<EntityOwnershipListenerActor> listenerActor = actorFactory.createTestActor( EntityOwnershipListenerActor.props(mockListener), actorFactory.generateActorId("listener")); DOMEntity entity = new DOMEntity("test", YangInstanceIdentifier.of(QName.create("test", "id1"))); boolean wasOwner = false; boolean isOwner = true; boolean hasOwner = true; listenerActor.tell(new DOMEntityOwnershipChange(entity, EntityOwnershipChangeState.from( wasOwner, isOwner, hasOwner)), ActorRef.noSender()); verify(mockListener, timeout(5000)).ownershipChanged(ownershipChange(entity, wasOwner, isOwner, hasOwner)); }