### Question:
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);  }### Answer:
@Test public void should_update_report_option() throws Exception { reportOptionsUseCase.updateReportOption(REPORT_URI, OPTION_ID, REPORT_PARAMETERS); verify(mReportOptionRestApi).updateReportOption(REPORT_URI, OPTION_ID, REPORT_PARAMETERS); }
@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); } }
@Test public void update_report_option_adapts_http_exception() throws Exception { doThrow(mHttpException).when(mReportOptionRestApi).updateReportOption(anyString(), anyString(), anyListOf(ReportParameter.class)); try { reportOptionsUseCase.updateReportOption(REPORT_URI, OPTION_LABEL, REPORT_PARAMETERS); fail("Should adapt HTTP exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mHttpException); } }