SimpleWindowsFileSystem extends BaseSimpleFileSystem { @Override public Iterable<Path> getRootDirectories() { return new Iterable<Path>() { @Override public Iterator<Path> iterator() { return new Iterator<Path>() { int i = -1; @Override public boolean hasNext() { return (i + 1) < listRoots().length; } @Override public Path next() { i++; if (i >= listRoots().length) { throw new NoSuchElementException(); } return getPath(listRoots()[i].toString()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } SimpleWindowsFileSystem(final FileSystemProvider provider,
                            final String path);   SimpleWindowsFileSystem(final File[] roots,
                            final FileSystemProvider provider,
                            final String path); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iterable<FileStore> getFileStores(); @Override void dispose();  }
@Test(expected = UnsupportedOperationException.class) public void removeElementFromRootIteratorUnsupportedOp() { new SimpleWindowsFileSystem(fsProvider, "c:\\").getRootDirectories().iterator().remove(); }
@Test(expected = NoSuchElementException.class) public void invalidElementFromRootIterator() { final Iterator<Path> iterator = new SimpleWindowsFileSystem(singleRoot, fsProvider, "c:\\").getRootDirectories().iterator(); try { iterator.next(); } catch (Exception e) { fail("first is valid"); } iterator.next(); }