@Override
  public void lockInode(Inode inode, LockMode mode) {
    mode = nextLockMode(mode);
    if (!mLocks.isEmpty()) {
      Preconditions.checkState(!endsInInode(),
          "Cannot lock inode %s for lock list %s because the lock list already ends in an inode",
          inode.getId(), this);
      checkInodeNameAndEdgeNameMatch(inode);
    }
    lockAndAddInode(inode, mode);
  }
@Test
  public void lockInodeAfterInode() {
    mLockList.lockInode(mDirA, LockMode.READ);
    mThrown.expect(IllegalStateException.class);
    mLockList.lockInode(mDirB, LockMode.READ);
  }