@Override
  public void lockEdge(Inode lastInode, String childName, LockMode mode) {
    mode = nextLockMode(mode);
    long edgeParentId = lastInode.getId();
    Edge edge = new Edge(lastInode.getId(), childName);
    if (!mLocks.isEmpty()) {
      Preconditions.checkState(endsInInode(),
          "Cannot lock edge %s when lock list %s already ends in an edge", edge, this);
      Preconditions.checkState(lastInode().getId() == edgeParentId,
          "Cannot lock edge %s when the last inode id in %s is %s", edge, this, lastInode.getId());
    }
    lockAndAddEdge(edge, mode);
  }
@Test
  public void lockEdgeAfterEdge() {
    mLockList.lockEdge(mDirA, mDirB.getName(), LockMode.READ);
    mThrown.expect(IllegalStateException.class);
    mLockList.lockEdge(mDirB, mFileC.getName(), LockMode.READ);
  }