@Test public void testGetAllRepositories() { List<Repository> repositories = new ArrayList<>(); List<Path> paths = new ArrayList<>(); for (int i = 0; i < REPOSITORIES_SIZE; i++) { paths.add(mock(Path.class)); Repository repository = mock(Repository.class); when(repository.getId()).thenReturn(REPOSITORY_ID + Integer.toString(i)); repositories.add(repository); } for (int i = 0; i < REPOSITORIES_SIZE; i++) { sourceRegistry.registerRepositorySources(paths.get(i), repositories.get(i)); } List<Repository> result = sourceRegistry.getAllRepositories(); assertEquals(repositories.size(), result.size()); for (Repository repository : repositories) { assertTrue(result.contains(repository)); } }
@Override public List<Repository> getAllRepositories() { return new ArrayList<>(repositorySourcesPath.values()); }
InMemorySourceRegistry implements SourceRegistry { @Override public List<Repository> getAllRepositories() { return new ArrayList<>(repositorySourcesPath.values()); } }
InMemorySourceRegistry implements SourceRegistry { @Override public List<Repository> getAllRepositories() { return new ArrayList<>(repositorySourcesPath.values()); } InMemorySourceRegistry(); }
InMemorySourceRegistry implements SourceRegistry { @Override public List<Repository> getAllRepositories() { return new ArrayList<>(repositorySourcesPath.values()); } InMemorySourceRegistry(); @Override void registerRepositorySources(final Path path,
                                          final Repository repo); @Override List<Repository> getAllRepositories(); @Override List<Project> getAllProjects(final Repository repository); @Override void registerSource(final Repository repo,
                               final Source source); @Override void registerProject(final Source source,
                                final Project project); }
InMemorySourceRegistry implements SourceRegistry { @Override public List<Repository> getAllRepositories() { return new ArrayList<>(repositorySourcesPath.values()); } InMemorySourceRegistry(); @Override void registerRepositorySources(final Path path,
                                          final Repository repo); @Override List<Repository> getAllRepositories(); @Override List<Project> getAllProjects(final Repository repository); @Override void registerSource(final Repository repo,
                               final Source source); @Override void registerProject(final Source source,
                                final Project project);  }