superuser.removeLockToken(lockToken);
otherSession.addLockToken(lockToken);
// otherSession is now lockHolder -> unlock must succeed.
Node n2 = (Node) otherSession.getItem(lockedNode.getPath());
n2.unlock();
} catch (RepositoryException e) {
// only in case of failure:
// move lock token back in order to have lock removed properly
// if test succeeds, moving back tokens is not necessary.
otherSession.removeLockToken(lockToken);