### Question:
ReportScheduleUseCase { public JobForm readJob(int jobId) throws ServiceException { try { JobFormEntity entity = mScheduleRestApi.requestJob(jobId); return mJobFormMapper.toDataForm(entity); } catch (IOException e) { throw mExceptionMapper.transform(e); } catch (HttpException e) { throw mExceptionMapper.transform(e); } } 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_read_job() throws Exception { when(mScheduleRestApi.requestJob(anyInt())).thenReturn(mJobFormEntity); JobForm expected = useCase.readJob(JOB_ID); assertThat(mJobForm, is(expected)); verify(mJobFormMapper).toDataForm(mJobFormEntity); verify(mScheduleRestApi).requestJob(JOB_ID); }
@Test public void read_job_adapts_io_exception() throws Exception { when(mScheduleRestApi.requestJob(anyInt())).thenThrow(mIOException); try { useCase.readJob(JOB_ID); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
@Test public void read_job_adapts_http_exception() throws Exception { when(mScheduleRestApi.requestJob(anyInt())).thenThrow(mHttpException); try { useCase.readJob(JOB_ID); fail("Should adapt HTTP exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mHttpException); } }