@Test public void mustNotThrowExceptionWhenDirectoryDoesntExist() throws Exception { File mainDir = null; try { mainDir = Files.createTempDirectory(getClass().getSimpleName()).toFile(); File fakeFolder = new File(mainDir, "DOESNOTEXIST"); Mockito.when(mavenProject.getCompileClasspathElements()).thenReturn(Collections.emptyList()); Build build = Mockito.mock(Build.class); Mockito.when(mavenProject.getBuild()).thenReturn(build); Mockito.when(build.getOutputDirectory()).thenReturn(fakeFolder.getAbsolutePath()); fixture.execute(); } finally { if (mainDir != null) { FileUtils.deleteDirectory(mainDir); } } }
@Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); File mainOutputFolder = new File(getProject().getBuild().getOutputDirectory()); if (!mainOutputFolder.isDirectory()) { log.warn("Main folder doesn't exist -- nothing to instrument"); return; } List<String> classpath; try { classpath = getProject().getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Dependency resolution problem", ex); } log.debug("Processing main output folder ... "); instrumentPath(log, classpath, mainOutputFolder); }
MainInstrumentMojo extends AbstractInstrumentMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); File mainOutputFolder = new File(getProject().getBuild().getOutputDirectory()); if (!mainOutputFolder.isDirectory()) { log.warn("Main folder doesn't exist -- nothing to instrument"); return; } List<String> classpath; try { classpath = getProject().getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Dependency resolution problem", ex); } log.debug("Processing main output folder ... "); instrumentPath(log, classpath, mainOutputFolder); } }
MainInstrumentMojo extends AbstractInstrumentMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); File mainOutputFolder = new File(getProject().getBuild().getOutputDirectory()); if (!mainOutputFolder.isDirectory()) { log.warn("Main folder doesn't exist -- nothing to instrument"); return; } List<String> classpath; try { classpath = getProject().getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Dependency resolution problem", ex); } log.debug("Processing main output folder ... "); instrumentPath(log, classpath, mainOutputFolder); }  }
MainInstrumentMojo extends AbstractInstrumentMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); File mainOutputFolder = new File(getProject().getBuild().getOutputDirectory()); if (!mainOutputFolder.isDirectory()) { log.warn("Main folder doesn't exist -- nothing to instrument"); return; } List<String> classpath; try { classpath = getProject().getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Dependency resolution problem", ex); } log.debug("Processing main output folder ... "); instrumentPath(log, classpath, mainOutputFolder); }  @Override void execute(); }
MainInstrumentMojo extends AbstractInstrumentMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { Log log = getLog(); File mainOutputFolder = new File(getProject().getBuild().getOutputDirectory()); if (!mainOutputFolder.isDirectory()) { log.warn("Main folder doesn't exist -- nothing to instrument"); return; } List<String> classpath; try { classpath = getProject().getCompileClasspathElements(); } catch (DependencyResolutionRequiredException ex) { throw new MojoExecutionException("Dependency resolution problem", ex); } log.debug("Processing main output folder ... "); instrumentPath(log, classpath, mainOutputFolder); }  @Override void execute();  }