### Question:
DefaultWikiProvisioningJobExecutor implements WikiProvisioningJobExecutor, Initializable { @Override public WikiProvisioningJob createAndExecuteJob(String wikiId, String provisioningJobName, Object parameter) throws WikiProvisioningJobException { try { XWikiContext xcontext = xcontextProvider.get(); WikiProvisioningJob job = componentManager.getInstance(Job.class, provisioningJobName); List<String> jobId = new ArrayList<String>(); jobId.add("wiki"); jobId.add("provisioning"); jobId.add(provisioningJobName); jobId.add(wikiId); job.initialize(new WikiProvisioningJobRequest(jobId, wikiId, parameter, xcontext.getUserReference())); jobs.put(jobId, job); jobExecutor.execute(job); return job; } catch (ComponentLookupException e) { throw new WikiProvisioningJobException( String.format("Failed to lookup provisioning job component for role [%s]", provisioningJobName), e); } }  @Override void initialize(); @Override WikiProvisioningJob createAndExecuteJob(String wikiId, String provisioningJobName, Object parameter); @Override WikiProvisioningJob getJob(List<String> jobId);  }### Answer:
@Test public void createAndExecuteJob() throws Exception { WikiProvisioningJob provisioningJob = mock(WikiProvisioningJob.class); mocker.registerComponent(Job.class, "wikiprovisioning.test", provisioningJob); ExecutionContextManager executionContextManager = mock(ExecutionContextManager.class); mocker.registerComponent(ExecutionContextManager.class, executionContextManager); Execution execution = mock(Execution.class); mocker.registerComponent(Execution.class, execution); DocumentReference user = new DocumentReference("xwiki", "XWiki", "User"); when(xcontext.getUserReference()).thenReturn(user); WikiProvisioningJob job = mocker.getComponentUnderTest().createAndExecuteJob("wikiid", "wikiprovisioning.test", "templateid"); List<String> jobId = new ArrayList<String>(); jobId.add("wiki"); jobId.add("provisioning"); jobId.add("wikiprovisioning.test"); jobId.add("wikiid"); verify(provisioningJob).initialize(eq(new WikiProvisioningJobRequest(jobId, "wikiid", "templateid", user))); Thread.sleep(100); verify(provisioningJob).run(); assertEquals(mocker.getComponentUnderTest().getJob(jobId), job); }