@Test public void request_controls_adapt_http_exception() throws Exception { when(mRestApi.requestInputControls(anyString(), anySetOf(String.class), anyBoolean())).thenThrow(mHttpException); try { mReportControlsUseCase.requestControls(REPORT_URI, null, false); fail("Should adapt HTTP exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mHttpException); } }
public List<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState) throws ServiceException { try { return mRestApi.requestInputControls(reportUri, ids, excludeState); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } }
ReportControlsUseCase { public List<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState) throws ServiceException { try { return mRestApi.requestInputControls(reportUri, ids, excludeState); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } }
ReportControlsUseCase { public List<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState) throws ServiceException { try { return mRestApi.requestInputControls(reportUri, ids, excludeState); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } ReportControlsUseCase(ServiceExceptionMapper exceptionMapper, InputControlRestApi restApi); }
ReportControlsUseCase { public List<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState) throws ServiceException { try { return mRestApi.requestInputControls(reportUri, ids, excludeState); } 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<InputControl> requestControls(String reportUri, Set<String> ids, boolean excludeState) throws ServiceException { try { return mRestApi.requestInputControls(reportUri, ids, excludeState); } 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);  }