@Test public void create() throws IOException { final java.io.File file = testFolder.getRoot(); new DirectoryWithAutomaticDeletion(new Directory.Fake(file.toPath())).create(); MatcherAssert.assertThat("The directory wasn't created", file.exists()); }
@Override public final void create() throws IOException { Runtime.getRuntime() .addShutdownHook( new Thread("ds") { @Override public void run() { try { directory.remove(); } catch (IOException e) { throw new RuntimeException(e); } } }); directory.create(); }
DirectoryWithAutomaticDeletion implements Directory { @Override public final void create() throws IOException { Runtime.getRuntime() .addShutdownHook( new Thread("ds") { @Override public void run() { try { directory.remove(); } catch (IOException e) { throw new RuntimeException(e); } } }); directory.create(); } }
DirectoryWithAutomaticDeletion implements Directory { @Override public final void create() throws IOException { Runtime.getRuntime() .addShutdownHook( new Thread("ds") { @Override public void run() { try { directory.remove(); } catch (IOException e) { throw new RuntimeException(e); } } }); directory.create(); } DirectoryWithAutomaticDeletion(Directory directory); }
DirectoryWithAutomaticDeletion implements Directory { @Override public final void create() throws IOException { Runtime.getRuntime() .addShutdownHook( new Thread("ds") { @Override public void run() { try { directory.remove(); } catch (IOException e) { throw new RuntimeException(e); } } }); directory.create(); } DirectoryWithAutomaticDeletion(Directory directory); @Override final void create(); @Override final void remove(); @Override final Path path(); @Override final boolean exist(); }
DirectoryWithAutomaticDeletion implements Directory { @Override public final void create() throws IOException { Runtime.getRuntime() .addShutdownHook( new Thread("ds") { @Override public void run() { try { directory.remove(); } catch (IOException e) { throw new RuntimeException(e); } } }); directory.create(); } DirectoryWithAutomaticDeletion(Directory directory); @Override final void create(); @Override final void remove(); @Override final Path path(); @Override final boolean exist();  }