@Test(expected = MojoFailureException.class)
public void testExecute_failDir() throws Exception {

    final File testOutDir = new File(testOutBaseDir, "testExecute_failDir");
    FileUtils.deleteDirectory(testOutDir);
    OpearPlanMojo mojo = newMojo();
    final MavenProject project = mock(MavenProject.class);
    mojo.project = project;
    final Build build = mock(Build.class);
    when(project.getBuild()).thenReturn(build);
    final File classes = new File(testOutDir, "classes");
    when(build.getOutputDirectory()).thenReturn(classes.getPath());
    final MavenSession session = mock(MavenSession.class);
    mojo.session = session;
    final MavenExecutionRequest executionRequest = mock(MavenExecutionRequest.class);
    when(session.getRequest()).thenReturn(executionRequest);
    final RepositorySystem repositorySystem = mock(RepositorySystem.class);
    mojo.repositorySystem = repositorySystem;
    mojo.planFile = new File(testOutDir, "opear-plans/plan.json");
    mojo.planFile.mkdirs();
    mojo.execute();
}