@Test public void delete_jobs_adapts_io_exception() throws Exception { when(mScheduleRestApi.deleteJobs(anySetOf(Integer.class))).thenThrow(mIOException); try { useCase.deleteJobs(JOB_IDS); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
public Set<Integer> deleteJobs(Set<Integer> jobIds) throws ServiceException { try { return mScheduleRestApi.deleteJobs(jobIds); } catch (IOException e) { throw mExceptionMapper.transform(e); } catch (HttpException e) { throw mExceptionMapper.transform(e); } }
ReportScheduleUseCase { public Set<Integer> deleteJobs(Set<Integer> jobIds) throws ServiceException { try { return mScheduleRestApi.deleteJobs(jobIds); } catch (IOException e) { throw mExceptionMapper.transform(e); } catch (HttpException e) { throw mExceptionMapper.transform(e); } } }
ReportScheduleUseCase { public Set<Integer> deleteJobs(Set<Integer> jobIds) throws ServiceException { try { return mScheduleRestApi.deleteJobs(jobIds); } 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
    ); }
ReportScheduleUseCase { public Set<Integer> deleteJobs(Set<Integer> jobIds) throws ServiceException { try { return mScheduleRestApi.deleteJobs(jobIds); } 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); }
ReportScheduleUseCase { public Set<Integer> deleteJobs(Set<Integer> jobIds) throws ServiceException { try { return mScheduleRestApi.deleteJobs(jobIds); } 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);  }