### Question:
Directories { @Nonnegative public static int count(@Nonnull final Path dir) throws IOException { try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) { return Iterables.size(stream); } catch (DirectoryIteratorException ex) { throw ex.getCause(); } } private  Directories(); @Nonnegative static int count(@Nonnull final Path dir); @Nonnull static List<Path> list(@Nonnull final Path dir);  }### Answer:
@Test public void count() throws IOException { Assert.assertEquals(0, Directories.count(root)); tempDir.newFile("foo1"); Assert.assertEquals(1, Directories.count(root)); final File dir = tempDir.newFolder("dir"); Assert.assertEquals(2, Directories.count(root)); Assert.assertTrue(new File(dir, "foo2").createNewFile()); Assert.assertEquals(2, Directories.count(root)); }