### Question:
InstallMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { try { JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb"); Unmarshaller unmarshaller = context.createUnmarshaller(); Marshaller marshaller = context.createMarshaller(); HttpClient httpClient = new HttpClient(); httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(this.username, this.password)); httpClient.getParams().setAuthenticationPreemptive(true); installExtensions(marshaller, unmarshaller, httpClient); } catch (Exception e) { throw new MojoExecutionException("Failed to install Extension(s) into XWiki", e); } }  @Override void execute();  }### Answer:
@Test public void install() throws Exception { stubFor(put(urlEqualTo("/xwiki/rest/jobs?jobType=install&async=false")) .willReturn(aResponse() .withBodyFile("jobStatus.xml"))); InstallMojo mojo = new InstallMojo(); ReflectionUtils.setFieldValue(mojo, "xwikiRESTURL", "http: ReflectionUtils.setFieldValue(mojo, "username", "superadmin"); ReflectionUtils.setFieldValue(mojo, "password", "pass"); ReflectionUtils.setFieldValue(mojo, "extensionIds", Arrays.asList(new ExtensionId().withId("id").withVersion("version"))); mojo.execute(); }