@Test public void update_report_option_adapts_io_exception() throws Exception { doThrow(mIOException).when(mReportOptionRestApi).updateReportOption(anyString(), anyString(), anyListOf(ReportParameter.class)); try { reportOptionsUseCase.updateReportOption(REPORT_URI, OPTION_LABEL, REPORT_PARAMETERS); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
public void updateReportOption(String reportUri, String optionId, List<ReportParameter> parameters) throws ServiceException { try { mReportOptionRestApi.updateReportOption(reportUri, optionId, parameters); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } }
ReportOptionsUseCase { public void updateReportOption(String reportUri, String optionId, List<ReportParameter> parameters) throws ServiceException { try { mReportOptionRestApi.updateReportOption(reportUri, optionId, parameters); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } }
ReportOptionsUseCase { public void updateReportOption(String reportUri, String optionId, List<ReportParameter> parameters) throws ServiceException { try { mReportOptionRestApi.updateReportOption(reportUri, optionId, parameters); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } ReportOptionsUseCase(ServiceExceptionMapper exceptionMapper, ReportOptionRestApi reportOptionRestApi, ReportOptionMapper reportOptionMapper); }
ReportOptionsUseCase { public void updateReportOption(String reportUri, String optionId, List<ReportParameter> parameters) throws ServiceException { try { mReportOptionRestApi.updateReportOption(reportUri, optionId, parameters); } 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); }
ReportOptionsUseCase { public void updateReportOption(String reportUri, String optionId, List<ReportParameter> parameters) throws ServiceException { try { mReportOptionRestApi.updateReportOption(reportUri, optionId, parameters); } 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);  }