### Question:
ReportOptionsUseCase { public Set<ReportOption> requestReportOptionsList(String reportUnitUri) throws ServiceException { try { Set<ReportOptionEntity> entities = mReportOptionRestApi.requestReportOptionsList(reportUnitUri); return mReportOptionMapper.transform(entities); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } ReportOptionsUseCase(ServiceExceptionMapper exceptionMapper, ReportOptionRestApi reportOptionRestApi, ReportOptionMapper reportOptionMapper); Set<ReportOption> requestReportOptionsList(String reportUnitUri); ReportOption createReportOption(String reportUri,
                                           String optionLabel,
                                           List<ReportParameter> parameters,
                                           boolean overwrite); void updateReportOption(String reportUri, String optionId, List<ReportParameter> parameters); void deleteReportOption(String reportUri, String optionId);  }### Answer:
@Test public void should_list_report_options() throws Exception { reportOptionsUseCase.requestReportOptionsList(REPORT_URI); verify(mReportOptionMapper).transform(anySetOf(ReportOptionEntity.class)); verify(mReportOptionRestApi).requestReportOptionsList(REPORT_URI); }
@Test public void list_report_options_adapts_io_exception() throws Exception { when(mReportOptionRestApi.requestReportOptionsList(anyString())).thenThrow(mIOException); try { reportOptionsUseCase.requestReportOptionsList(REPORT_URI); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
@Test public void list_report_options_adapts_http_exception() throws Exception { when(mReportOptionRestApi.requestReportOptionsList(anyString())).thenThrow(mHttpException); try { reportOptionsUseCase.requestReportOptionsList(REPORT_URI); fail("Should adapt HTTP exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mHttpException); } }