### Question:
ReportScheduleUseCase { public JobData createJob(JobForm form) throws ServiceException { return alterJob(form, null); } ReportScheduleUseCase(ServiceExceptionMapper exceptionMapper,
                          ReportScheduleRestApi scheduleRestApi,
                          InfoCacheManager cacheManager,
                          JobSearchCriteriaMapper searchCriteriaMapper,
                          JobDataMapper jobDataMapper,
                          JobFormMapper jobFormMapper,
                          JobUnitMapper jobUnitMapper
    ); List<JobUnit> searchJob(JobSearchCriteria criteria); JobData createJob(JobForm form); JobData updateJob(int id, JobForm form); Set<Integer> deleteJobs(Set<Integer> jobIds); JobForm readJob(int jobId);  }### Answer:
@Test public void should_perform_create_job() throws Exception { when(mScheduleRestApi.createJob(any(JobFormEntity.class))).thenReturn(mJobDescriptor); useCase.createJob(mJobForm); verify(mJobDataMapper).transform(mJobDescriptor, SIMPLE_DATE_FORMAT); verify(mScheduleRestApi).createJob(mJobFormEntity); }
@Test public void create_job_adapts_io_exception() throws Exception { when(mScheduleRestApi.createJob(any(JobFormEntity.class))).thenThrow(mIOException); try { useCase.createJob(mJobForm); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
@Test public void create_job_adapts_http_exception() throws Exception { when(mScheduleRestApi.createJob(any(JobFormEntity.class))).thenThrow(mHttpException); try { useCase.createJob(mJobForm); fail("Should adapt HTTP exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mHttpException); } }