@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); }
@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); } }
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); } } }
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); } }  }
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); }
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);  }