### Question:
DefaultOutput extends DefaultResource<File> implements Output<File> { @Override public OutputStream newOutputStream() throws IOException { return context.newOutputStream(this); } DefaultOutput(AbstractBuildContext context, DefaultBuildContextState state, File file); @Override OutputStream newOutputStream();  }### Answer:
@Test public void testOutputStream_createParentDirectories() throws Exception { File outputFile = new File(temp.getRoot(), "sub/dir/outputFile"); TestBuildContext context = newBuildContext(); Output<File> output = context.processOutput(outputFile); output.newOutputStream().close(); Assert.assertTrue(outputFile.canRead()); }