RepositoryManagerRESTAdapterImpl implements RepositoryManagerRESTAdapter { @Override public List<Repository> getRepositories() { return repositoryPermissionChecker.userCanBrowseRepositories(repositoryManager.browse()); } @Inject  RepositoryManagerRESTAdapterImpl(final RepositoryManager repositoryManager,
                                          final RepositoryPermissionChecker repositoryPermissionChecker); @Override Repository getRepository(final String repositoryId); @Override List<Repository> getRepositories(); @Override List<String> findContainingGroups(final String repositoryName);  }
@Test public void getRepositories() { when(repositoryPermissionChecker.userCanBrowseRepositories(asList(repository, repository2, repository3))) .thenReturn(asList(repository, repository2)); assertThat(underTest.getRepositories(), is(asList(repository, repository2))); }