@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));
}