MultiRepositoryManager { public List<RepositoryProperties> getRepositoriesAsList() { IRepository repository = RepositoryFactory.getRepository(); if (repository instanceof MultiRepository) { return ((MultiRepository) repository).getRepositoriesFromFile(); } return Collections.emptyList(); }  List<RepositoryProperties> getRepositoriesAsList(); void addRepositoryToFile(List<RepositoryProperties> repositories);  }
@Test public void testGetRepositoriesAsList() { writeDependencyFile(); MultiRepositoryManager multiRepositoryManager = new MultiRepositoryManager(); List<RepositoryProperties> dependencies = multiRepositoryManager.getRepositoriesAsList(); assertEquals(1, dependencies.size()); RepositoryProperties testRepoDependency = dependencies.get(0); assertEquals("test", testRepoDependency.getName()); assertEquals("plain", testRepoDependency.getBranch()); assertEquals("https: }
@Test public void testGetRepositoriesAsListOnNonMultiRepository() { try { } catch (Exception e) { e.printStackTrace(); } MultiRepositoryManager multiRepositoryManager = new MultiRepositoryManager(); List<RepositoryProperties> dependencies = multiRepositoryManager.getRepositoriesAsList(); if (dependencies.size() > 0) { dependencies.forEach(dependency -> { System.out.println(dependency.getName()); }); } assertEquals(0, dependencies.size()); }