### Question:
DefaultWikiCreator implements WikiCreator { @Override public Job createWiki(WikiCreationRequest request) throws WikiCreationException { try { request.setId(getJobId(request.getWikiId())); return jobExecutor.execute(WikiCreationJob.JOB_TYPE, request); } catch (JobException e) { throw new WikiCreationException("Failed to create a new wiki.", e); } }  @Override Job createWiki(WikiCreationRequest request); @Override JobStatus getJobStatus(String wikiId);  }### Answer:
@Test public void createWiki() throws Exception { WikiCreationRequest request = new WikiCreationRequest(); request.setWikiId("wikiId"); Job job = mock(Job.class); when(jobExecutor.execute("wikicreationjob", request)).thenReturn(job); assertEquals(job, mocker.getComponentUnderTest().createWiki(request)); assertEquals(Arrays.asList("wikicreation", "createandinstall", "wikiId"), request.getId()); }
@Test public void createWikiWithException() throws Exception { WikiCreationRequest request = new WikiCreationRequest(); request.setWikiId("wikiId"); JobException jobException = new JobException("Error in JobException"); when(jobExecutor.execute("wikicreationjob", request)).thenThrow(jobException); WikiCreationException caughtException = null; try { mocker.getComponentUnderTest().createWiki(request); } catch (WikiCreationException e) { caughtException = e; } assertNotNull(caughtException); }