### Question:
FileStateHandle implements StreamStateHandle { @Override public void discardState() throws Exception { FileSystem fs = getFileSystem(); fs.delete(filePath, false); } FileStateHandle(Path filePath, long stateSize); Path getFilePath(); @Override FSDataInputStream openInputStream(); @Override void discardState(); @Override long getStateSize(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testDisposeDeletesFile() throws Exception { File file = tempFolder.newFile(); writeTestData(file); assertTrue(file.exists()); FileStateHandle handle = new FileStateHandle(Path.fromLocalFile(file), file.length()); handle.discardState(); assertFalse(file.exists()); }
@Test public void testDisposeDoesNotDeleteParentDirectory() throws Exception { File parentDir = tempFolder.newFolder(); assertTrue(parentDir.exists()); File file = new File(parentDir, "test"); writeTestData(file); assertTrue(file.exists()); FileStateHandle handle = new FileStateHandle(Path.fromLocalFile(file), file.length()); handle.discardState(); assertFalse(file.exists()); assertTrue(parentDir.exists()); }