### Question:
GlusterFileSystem extends FileSystem { @Override public void close() throws IOException { if (isOpen()) { int fini = provider.close(volptr); if (0 != fini) { throw new IOException("Unable to close filesystem: " + volname); } volptr = -1; } }  @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iterable<FileStore> getFileStores(); @Override Set<String> supportedFileAttributeViews(); @Override Path getPath(String s, String... strings); @Override PathMatcher getPathMatcher(String s); @Override UserPrincipalLookupService getUserPrincipalLookupService(); @Override WatchService newWatchService(); String toString();  }### Answer:
@Test(expected = IOException.class) public void testClose_whenFailing() throws IOException { doReturn(11).when(mockFileSystemProvider).close(VOLPTR); fileSystem.close(); }
@Test public void testClose() throws IOException { doReturn(0).when(mockFileSystemProvider).close(VOLPTR); fileSystem.close(); verify(mockFileSystemProvider).close(VOLPTR); assertEquals(-1, fileSystem.getVolptr()); }