@Test public void list_dashboard_components_adapts_io_exception() throws Exception { when(mRepositoryRestApi.requestDashboardComponents(anyString())).thenThrow(mIOException); try { useCase.requestDashboardComponents(DASHBOARD_URI); fail("Should adapt IO exception"); } catch (ServiceException ex) { verify(mExceptionMapper).transform(mIOException); } }
public DashboardComponentCollection requestDashboardComponents(String dashboardUri) throws ServiceException { try { return mRestApi.requestDashboardComponents(dashboardUri); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } }
RepositoryUseCase { public DashboardComponentCollection requestDashboardComponents(String dashboardUri) throws ServiceException { try { return mRestApi.requestDashboardComponents(dashboardUri); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } }
RepositoryUseCase { public DashboardComponentCollection requestDashboardComponents(String dashboardUri) throws ServiceException { try { return mRestApi.requestDashboardComponents(dashboardUri); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } RepositoryUseCase(ServiceExceptionMapper exceptionMapper, RepositoryRestApi restApi); }
RepositoryUseCase { public DashboardComponentCollection requestDashboardComponents(String dashboardUri) throws ServiceException { try { return mRestApi.requestDashboardComponents(dashboardUri); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } RepositoryUseCase(ServiceExceptionMapper exceptionMapper, RepositoryRestApi restApi); DashboardComponentCollection requestDashboardComponents(String dashboardUri); }
RepositoryUseCase { public DashboardComponentCollection requestDashboardComponents(String dashboardUri) throws ServiceException { try { return mRestApi.requestDashboardComponents(dashboardUri); } catch (HttpException e) { throw mExceptionMapper.transform(e); } catch (IOException e) { throw mExceptionMapper.transform(e); } } RepositoryUseCase(ServiceExceptionMapper exceptionMapper, RepositoryRestApi restApi); DashboardComponentCollection requestDashboardComponents(String dashboardUri);  }