@Test
public void testOnEntityOwnershipChangedWithListenerEx() {

    DOMEntityOwnershipListener mockListener = mock(DOMEntityOwnershipListener.class);
    DOMEntity entity1 = new DOMEntity("test", YangInstanceIdentifier.of(QName.create("test", "id1")));
    doThrow(new RuntimeException("mock")).when(mockListener).ownershipChanged(
            ownershipChange(entity1, false, true, true));
    DOMEntity entity2 = new DOMEntity("test", YangInstanceIdentifier.of(QName.create("test", "id2")));
    doNothing().when(mockListener).ownershipChanged(ownershipChange(entity2, true, false, false));
    TestActorRef<EntityOwnershipListenerActor> listenerActor = actorFactory.createTestActor(
            EntityOwnershipListenerActor.props(mockListener), actorFactory.generateActorId("listener"));
    listenerActor.tell(new DOMEntityOwnershipChange(entity1, EntityOwnershipChangeState.from(
            false, true, true)), ActorRef.noSender());
    listenerActor.tell(new DOMEntityOwnershipChange(entity2, EntityOwnershipChangeState.from(
            true, false, false)), ActorRef.noSender());
    verify(mockListener, timeout(5000)).ownershipChanged(ownershipChange(entity2, true, false, false));
}