### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public FileSystem newFileSystem(URI uri, Map<String, ?> stringMap) throws IOException { String authorityString = uri.getAuthority(); String[] authority = parseAuthority(authorityString); String volname = authority[1]; long volptr = glfsNew(volname); glfsSetVolfileServer(authority[0], volptr); glfsInit(authorityString, volptr); GlusterFileSystem fileSystem = new GlusterFileSystem(this, authority[0], volname, volptr); cache.put(authorityString, fileSystem); return fileSystem; }  @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> stringMap); @Override FileSystem getFileSystem(URI uri); @Override Path getPath(URI uri); @Override SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> openOptions, FileAttribute<?>... fileAttributes); @Override FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs); @Override DirectoryStream<Path> newDirectoryStream(Path path, DirectoryStream.Filter<? super Path> filter); @Override void createDirectory(Path path, FileAttribute<?>... fileAttributes); @Override void delete(Path path); @Override void copy(Path path, Path path2, CopyOption... copyOptions); @Override void move(Path path, Path path2, CopyOption... copyOptions); @Override boolean isSameFile(Path path, Path path2); @Override boolean isHidden(Path path); @Override FileStore getFileStore(Path path); @Override void checkAccess(Path path, AccessMode... accessModes); @Override V getFileAttributeView(Path path, Class<V> vClass, LinkOption... linkOptions); @Override A readAttributes(Path path, Class<A> type, LinkOption... linkOptions); @Override Map<String, Object> readAttributes(Path path, String s, LinkOption... linkOptions); @Override void setAttribute(Path path, String s, Object o, LinkOption... linkOptions); @Override Path readSymbolicLink(Path link); @Override void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs); static final String GLUSTER; static final int GLUSTERD_PORT; static final String TCP; }### Answer:
@Test public void testNewFileSystem() throws IOException, URISyntaxException { String authority = SERVER + ":" + VOLNAME; doReturn(new String[]{SERVER, VOLNAME}).when(provider).parseAuthority(authority); long volptr = 1234l; doReturn(volptr).when(provider).glfsNew(VOLNAME); doNothing().when(provider).glfsSetVolfileServer(SERVER, volptr); doNothing().when(provider).glfsInit(authority, volptr); URI uri = new URI("gluster: FileSystem fileSystem = provider.newFileSystem(uri, null); verify(provider).parseAuthority(authority); verify(provider).glfsNew(VOLNAME); verify(provider).glfsSetVolfileServer(SERVER, volptr); verify(provider).glfsInit(authority, volptr); assertTrue(provider.getCache().containsKey(authority)); assertEquals(fileSystem, provider.getCache().get(authority)); }