### Question:
InstallPhantomJsMojo extends AbstractPhantomJsMojo implements PhantomJsResolverOptions { public void run() throws MojoFailureException { String location = phantomJsResolver .options(this) .repositorySystem(repositorySystem) .repositorySystemSession(repositorySystemSession) .remoteRepositories(getMavenProject().getRemoteProjectRepositories()) .resolve(); if (location == null) { throw new MojoFailureException(UNABLE_TO_INSTALL); } this.setPhantomJsBinaryProperty(location); } @Inject  InstallPhantomJsMojo(MavenProject mavenProject,
                              RepositorySystem repositorySystem,
                              PhantomJsResolver phantomJsResolver); @Override Source getSource(); @Override String getVersion(); @Override boolean isCheckSystemPath(); @Override String getEnforceVersion(); @Override String getBaseUrl(); @Override File getOutputDirectory(); void run();  }### Answer:
@Test public void testRun() throws MojoFailureException { List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>(); when(mavenProject.getRemoteProjectRepositories()).thenReturn(remoteRepositories); when(mavenProject.getProperties()).thenReturn(new Properties()); when( phantomJsResolver.options(mojo) .repositorySystem(repositorySystem) .repositorySystemSession(repositorySystemSession) .remoteRepositories(remoteRepositories) .resolve() ).thenReturn("/usr/bin/phantomjs"); mojo.setPropertyName("phantomjs.binary"); mojo.setRepositorySystemSession(repositorySystemSession); mojo.run(); assertThat(mojo.getPhantomJsBinary()).isEqualTo("/usr/bin/phantomjs"); }