@Test public void request_controls_values_adapt_io_exception() throws Exception { when(mRestApi.requestInputControlsStates(anyString(), anyListOf(ReportParameter.class), anyBoolean())).thenThrow(mIOException); try { mReportControlsUseCase.requestControlsValues(REPORT_URI, PARAMS, false); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
public List<InputControlState> requestControlsValues(String reportUri, List<ReportParameter> parameters, boolean fresh) throws ServiceException { try { return mRestApi.requestInputControlsStates(reportUri, parameters, fresh); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } }
ReportControlsUseCase { public List<InputControlState> requestControlsValues(String reportUri, List<ReportParameter> parameters, boolean fresh) throws ServiceException { try { return mRestApi.requestInputControlsStates(reportUri, parameters, fresh); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } }
ReportControlsUseCase { public List<InputControlState> requestControlsValues(String reportUri, List<ReportParameter> parameters, boolean fresh) throws ServiceException { try { return mRestApi.requestInputControlsStates(reportUri, parameters, fresh); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } ReportControlsUseCase(ServiceExceptionMapper exceptionMapper, InputControlRestApi restApi); }
ReportControlsUseCase { public List<InputControlState> requestControlsValues(String reportUri, List<ReportParameter> parameters, boolean fresh) throws ServiceException { try { return mRestApi.requestInputControlsStates(reportUri, parameters, fresh); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } ReportControlsUseCase(ServiceExceptionMapper exceptionMapper, InputControlRestApi restApi); List<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState); List<InputControlState> requestControlsValues(String reportUri,
                                                         List<ReportParameter> parameters,
                                                         boolean fresh); List<InputControlState> requestResourceValues(String resourceUri, boolean freshData); }
ReportControlsUseCase { public List<InputControlState> requestControlsValues(String reportUri, List<ReportParameter> parameters, boolean fresh) throws ServiceException { try { return mRestApi.requestInputControlsStates(reportUri, parameters, fresh); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } ReportControlsUseCase(ServiceExceptionMapper exceptionMapper, InputControlRestApi restApi); List<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState); List<InputControlState> requestControlsValues(String reportUri,
                                                         List<ReportParameter> parameters,
                                                         boolean fresh); List<InputControlState> requestResourceValues(String resourceUri, boolean freshData);  }