SimpleUnixFileSystem extends BaseSimpleFileSystem { @Override public Iterable<Path> getRootDirectories() { return new Iterable<Path>() { @Override public Iterator<Path> iterator() { return new Iterator<Path>() { private int i = 0; @Override public boolean hasNext() { return i < 1; } @Override public Path next() { if (i < 1) { i++; return getPath("/"); } else { throw new NoSuchElementException(); } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } protected  SimpleUnixFileSystem(final FileSystemProvider provider,
                         final String path); @Override Path getPath(String first, String... more); @Override Iterable<Path> getRootDirectories(); @Override Iterable<FileStore> getFileStores(); @Override void dispose();  }
@Test(expected = UnsupportedOperationException.class) public void removeElementFromRootIteratorUnsupportedOp() { new SimpleUnixFileSystem(fsProvider, "/").getRootDirectories().iterator().remove(); }
@Test(expected = NoSuchElementException.class) public void invalidElementFromRootIterator() { final Iterator<Path> iterator = new SimpleUnixFileSystem(fsProvider, "/").getRootDirectories().iterator(); try { iterator.next(); } catch (Exception e) { fail("first is valid"); } iterator.next(); }