@Test public void should_perform_search() throws Exception { when(mScheduleRestApi.searchJob(anyMapOf(String.class, Object.class))).thenReturn(Collections.<JobUnitEntity>emptyList()); useCase.searchJob(CRITERIA); verify(mSearchCriteriaMapper).transform(CRITERIA); verify(mScheduleRestApi).searchJob(SEARCH_PARAMS); verify(mJobUnitMapper).transform(Collections.<JobUnitEntity>emptyList()); }
public List<JobUnit> searchJob(JobSearchCriteria criteria) throws ServiceException { try { Map<String, Object> searchParams = mSearchCriteriaMapper.transform(criteria); List<JobUnitEntity> jobUnitEntities = mScheduleRestApi.searchJob(searchParams); return mJobUnitMapper.transform(jobUnitEntities); } catch (IOException e) { throw mExceptionMapper.transform(e); } catch (HttpException e) { throw mExceptionMapper.transform(e); } }
ReportScheduleUseCase { public List<JobUnit> searchJob(JobSearchCriteria criteria) throws ServiceException { try { Map<String, Object> searchParams = mSearchCriteriaMapper.transform(criteria); List<JobUnitEntity> jobUnitEntities = mScheduleRestApi.searchJob(searchParams); return mJobUnitMapper.transform(jobUnitEntities); } catch (IOException e) { throw mExceptionMapper.transform(e); } catch (HttpException e) { throw mExceptionMapper.transform(e); } } }
ReportScheduleUseCase { public List<JobUnit> searchJob(JobSearchCriteria criteria) throws ServiceException { try { Map<String, Object> searchParams = mSearchCriteriaMapper.transform(criteria); List<JobUnitEntity> jobUnitEntities = mScheduleRestApi.searchJob(searchParams); return mJobUnitMapper.transform(jobUnitEntities); } 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 List<JobUnit> searchJob(JobSearchCriteria criteria) throws ServiceException { try { Map<String, Object> searchParams = mSearchCriteriaMapper.transform(criteria); List<JobUnitEntity> jobUnitEntities = mScheduleRestApi.searchJob(searchParams); return mJobUnitMapper.transform(jobUnitEntities); } 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 List<JobUnit> searchJob(JobSearchCriteria criteria) throws ServiceException { try { Map<String, Object> searchParams = mSearchCriteriaMapper.transform(criteria); List<JobUnitEntity> jobUnitEntities = mScheduleRestApi.searchJob(searchParams); return mJobUnitMapper.transform(jobUnitEntities); } 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);  }