### Question:
ExecPhantomJsMojo extends AbstractPhantomJsMojo { public void run() throws MojoFailureException { LOGGER.info("Executing phantomjs command"); String binary = this.getPhantomJsBinary(); PhantomJsProcessBuilder processBuilder = new PhantomJsProcessBuilder(binary) .configFile(this.configFile) .workingDirectory(this.workingDirectory) .commandLineOptions(this.commandLineOptions) .script(this.script) .arguments(this.arguments); try { int code = executor.execute(processBuilder); if (failOnNonZeroExitCode && code != 0) { throw new MojoFailureException(String.format(ABNORMAL_EXIT_CODE, code)); } } catch (ExecutionException e) { throw new MojoFailureException(EXECUTION_FAILURE, e); } } @Inject  ExecPhantomJsMojo(MavenProject mavenProject,
                           PhantomJsExecutor executor); void run();  }### Answer:
@Test public void testRun() throws Exception { when(mavenProject.getProperties()).thenReturn(properties); when(executor.execute(isA(PhantomJsProcessBuilder.class))).thenReturn(0); mojo.setFailOnNonZeroExitCode(true); mojo.run(); }