### Question:
Directory implements Serializable { public void create() throws DirectoryException { if (!getFile().exists()) { if (!getFile().mkdirs()) { throw new DirectoryException( "Could not create directory '" + getFile() + "'"); } } } Directory();  Directory(final File directory); static FileFilter getMatchAllFilesFilter(); void create(); File getFile(); File getFile(final File child); File[] listContents(final FileFilter filter); File[] listContents(final FileFilter filter,
                             final boolean includeDirectories,
                             final boolean absolutePaths); void deleteContents(); void delete(); File rebaseFromCWD(final File file); File relativeFile(final File file, final boolean mustBeChild); List<File> rebasePath(final String path); boolean isParentOf(final File file); void copyTo(final Directory target, final boolean incremental); String[] getWarnings(); @Override int hashCode(); @Override boolean equals(final Object o);  }### Answer:
@Test public void testCreate() throws Exception { final String[] directories = { "toplevel", "down/a/few", }; for (final String directorie : directories) { final Directory directory = new Directory(new File(getDirectory(), directorie)); assertFalse(directory.getFile().exists()); directory.create(); assertTrue(directory.getFile().exists()); } final File file = new File(getDirectory(), "readonly"); assertTrue(file.createNewFile()); FileUtilities.setCanAccess(file, false); try { new Directory(new File(getDirectory(), "readonly/foo")).create(); fail("Expected DirectoryException"); } catch (final Directory.DirectoryException e) { } }