### Question:
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);  }### Answer:
@Test public void should_request_controls() throws Exception { mReportControlsUseCase.requestControls(REPORT_URI, null, false); verify(mRestApi).requestInputControls(REPORT_URI, null, false); }
@Test public void request_controls_adapt_io_exception() throws Exception { when(mRestApi.requestInputControls(anyString(), anySetOf(String.class), anyBoolean())).thenThrow(mIOException); try { mReportControlsUseCase.requestControls(REPORT_URI, null, false); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
@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); } }