@Test public void createsMissingOutputDirectory() throws IOException { final File file = new File(getTestDir(), "missing/missing.txt"); assertFalse(file.getParentFile().isDirectory()); context.checking( new Expectations() { { one(renderer).setOutputFile(file); one(renderer).startProject(project); one(generator).run(); one(renderer).completeProject(project); one(renderer).complete(); } }); task.setOutputFile(file); task.generate(); assertTrue(file.getParentFile().isDirectory()); }
@Test public void setsOutputFileNameOnRendererBeforeGeneration() throws IOException { final File file = new File(getTestDir(), "report.txt"); context.checking( new Expectations() { { Sequence sequence = context.sequence("sequence"); one(renderer).setOutputFile(file); inSequence(sequence); one(renderer).startProject(project); inSequence(sequence); one(generator).run(); inSequence(sequence); one(renderer).completeProject(project); inSequence(sequence); one(renderer).complete(); inSequence(sequence); } }); task.setOutputFile(file); task.generate(); }