### Question:
DiagramMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { new DiagramGenerator(path, failIfMissing, view, width, height, adjust, output, format, outputFileName, rotateEdges, layout) { @Override protected void warn(final String s) { getLog().warn(s); } @Override protected void info(String s) { getLog().info(s); } }.execute(); }  @Override void execute();  }### Answer:
@Test public void generate() throws MojoFailureException, MojoExecutionException { final File target = new File("target/output/diagram.png"); target.delete(); final DiagramMojo mojo = new DiagramMojo(); mojo.path = "src/test/resources/META-INF/batch-jobs/diagram.xml"; mojo.failIfMissing = true; mojo.output = target.getParentFile(); mojo.view = false; mojo.width = 640; mojo.height = 480; mojo.adjust = true; mojo.format = "png"; mojo.layout = "spring170"; mojo.execute(); assertTrue(target.exists()); }
@Test(expectedExceptions = Exception.class) public void fail() throws MojoFailureException, MojoExecutionException { final DiagramMojo mojo = new DiagramMojo(); mojo.path = "missing-batch.xml"; mojo.failIfMissing = true; mojo.execute(); }