SystemFileSystem extends AbstractFileSystem { @Override public void makeDirsForFile(File f) throws IOException { Files.createParentDirs(f); } @Inject  SystemFileSystem(); @Override File getTemporaryDirectory(String prefix); @Override File getTemporaryDirectory(String prefix, Lifetime lifetime); @Override void cleanUpTempDirs(); @Override void setLifetime(File path, Lifetime lifetime); @Override Set<File> findFiles(File path); @Override File[] listFiles(File path); @Override boolean exists(File f); @Override String getName(File f); @Override boolean isFile(File f); @Override boolean isDirectory(File f); @Override boolean isExecutable(File f); @Override boolean isReadable(File f); @Override void setExecutable(File f); @Override void setNonExecutable(File f); @Override void makeDirsForFile(File f); @Override void makeDirs(File f); @Override void copyFile(File src, File dest); @Override void write(String contents, File f); @Override void deleteRecursively(File file); @Override File getResourceAsFile(String resource); @Override String fileToString(File f);  }
@Test public void testMakeDirsForFile() throws Exception { File baz = new File(tempDir, "foo/bar/baz"); File bar = new File(tempDir, "foo/bar"); fs.makeDirsForFile(baz); assertThat(bar.exists()).isTrue(); assertThat(bar.isDirectory()).isTrue(); assertThat(baz.exists()).isFalse(); }