### Question:
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);  }### Answer:
@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); } }
@Test public void request_controls_values_adapt_http_exception() throws Exception { when(mRestApi.requestInputControlsStates(anyString(), anyListOf(ReportParameter.class), anyBoolean())).thenThrow(mHttpException); try { mReportControlsUseCase.requestControlsValues(REPORT_URI, PARAMS, false); fail("Should adapt HTTP exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mHttpException); } }
@Test public void should_request_controls_values() throws Exception { mReportControlsUseCase.requestControlsValues(REPORT_URI, PARAMS, false); verify(mRestApi).requestInputControlsStates(REPORT_URI, PARAMS, false); }