use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class SourceServiceImplTest method testGetBranches.
@Test
public void testGetBranches() {
final List<Branch> branches = new ArrayList<>();
branches.add(new Branch("branch1", mock(Path.class)));
branches.add(new Branch("branch2", mock(Path.class)));
branches.add(new Branch("branch3", mock(Path.class)));
Repository repository = mock(Repository.class);
when(repository.getBranches()).thenReturn(branches);
when(repositoryService.getRepositoryFromSpace(SPACE, REPO_NAME)).thenReturn(repository);
final Collection<String> result = service.getBranches(SPACE, REPO_NAME);
final List<String> originalBranchNames = new ArrayList<>();
for (final Branch branch : branches) {
originalBranchNames.add(branch.getName());
}
assertEquals(originalBranchNames, result);
}
Aggregations