### Question:
DefaultFileSystemUtils implements com.github.approval.utils.FileSystemUtils { @Override public void createDirectories(File directory) throws IOException { LOG.info("Creating directory " + directory); if (!directory.mkdirs()) { throw new IOException("Couldn't create directory " + directory); } }  @Override void write(Path path, byte[] value); @Override byte[] readFully(Path path); @Override void move(Path path, Path filePath); @Override void createDirectories(File directory); @Override void touch(Path pathToCreate);  }### Answer:
@Test(expected = IOException.class) public void shouldProperlyThrowAnExceptionIfItCannotCreateDirectory() throws Exception { File file = FileSystems.getDefault().getPath("target", "directory-with-no-permissions").toFile(); file.delete(); if(!file.mkdir()) { throw new AssertionError("Couldn't create fixture directory?"); } file.setReadable(false); file.setExecutable(false); file.setWritable(false); new DefaultFileSystemUtils().createDirectories(new File(file, "t")); }
@Test public void shouldProperlyCreateDirectory() throws Exception { Path target = Paths.get("target", "directory-with-permissions"); File directory = target.toFile(); directory.delete(); new DefaultFileSystemUtils().createDirectories(directory); }