### Question:
FileObservable { public static Observable<Path> fileTreeWalker(final Path root) { return Observable.create(new OnSubscribe<Path>() { @Override public void call(final Subscriber<? super Path> o) { SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (o.isUnsubscribed()) return FileVisitResult.TERMINATE; o.onNext(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { if (o.isUnsubscribed()) return FileVisitResult.TERMINATE; o.onError(exc); return FileVisitResult.TERMINATE; } }; try { Files.walkFileTree(root, visitor); if (o.isUnsubscribed()) return; o.onCompleted(); } catch (IOException e) { if (o.isUnsubscribed()) return; o.onError(e); } } }); } private  FileObservable(); static Observable<Path> fileTreeWalker(final Path root); static Observable<String> lines(final Path path); static Observable<String> unzipLines(final Path path); static Func1<Path, Observable<String>> lines();  }### Answer:
@Test public void testWalking() throws IOException, InterruptedException { Path dir = tempFolder.getRoot().toPath(); List<Path> files = createTestTree(dir, "a/a", "a/b", "b/a", "b/b"); TestObserver<Path> testObserver = new TestObserver<>(); Observable<Path> walk = FileObservable.fileTreeWalker(dir); walk.subscribe(testObserver); List<Path> observedFiles = testObserver.getOnNextEvents(); assertTrue(files.containsAll(observedFiles) && observedFiles.containsAll(files)); testObserver.assertTerminalEvent(); }