static boolean unprotectedSetTimes(
      FSDirectory fsd, INodesInPath iip, long mtime, long atime, boolean force)
      throws FileNotFoundException {
    assert fsd.hasWriteLock();
    boolean status = false;
    INode inode = iip.getLastINode();
    if (inode == null) {
      throw new FileNotFoundException("File/Directory " + iip.getPath() +
          " does not exist.");
    }
    int latest = iip.getLatestSnapshotId();
    if (mtime >= 0) {
      inode = inode.setModificationTime(mtime, latest);
      status = true;
    }

    // if the last access time update was within the last precision interval,
    // then no need to store access time
    if (atime >= 0 && (status || force
        || atime > inode.getAccessTime() + fsd.getAccessTimePrecision())) {
      inode.setAccessTime(atime, latest,
          fsd.getFSNamesystem().getSnapshotManager().
          getSkipCaptureAccessTimeOnlyChange());
      status = true;
    }
    return status;
  }
@Test(expected = FileNotFoundException.class)
  public void testUnprotectedSetTimesFNFE()
      throws FileNotFoundException {
    FSDirectory fsd = Mockito.mock(FSDirectory.class);
    INodesInPath iip = Mockito.mock(INodesInPath.class);

    when(fsd.hasWriteLock()).thenReturn(Boolean.TRUE);
    when(iip.getLastINode()).thenReturn(null);

    FSDirAttrOp.unprotectedSetTimes(fsd, iip, 0, 0, false);
  }