FakeFileManager extends FileManager { public FakeFileManager(File root) { super(root); } FakeFileManager(File root); OutputStream create(String path, String name); void finalize(OutputStream stream);  }
@Test public void testFakeFileManager() throws IOException { FakeFileManager fake = new FakeFileManager(tmp.getRoot()); OutputStream out = fake.create("tmp/boo", "foo.bar"); out.write(("Test\n" + "More\n").getBytes(UTF_8)); fake.finalize(out); assertThat(console.error(), is("")); assertThat(console.output(), is("\n" + "### --> tmp/boo/foo.bar\n" + "Test\n" + "More\n" + "### <-- END\n")); }