@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); }
@Override public Collection<String> getBranches(final Space space, final String repositoryName) { checkNotNull("repositoryName", repositoryName); final Repository repository = repositoryService.getRepositoryFromSpace(space, repositoryName); return repository != null ? toBranchNames(repository.getBranches()) : new ArrayList<>(); }
SourceServiceImpl implements SourceService { @Override public Collection<String> getBranches(final Space space, final String repositoryName) { checkNotNull("repositoryName", repositoryName); final Repository repository = repositoryService.getRepositoryFromSpace(space, repositoryName); return repository != null ? toBranchNames(repository.getBranches()) : new ArrayList<>(); } }
SourceServiceImpl implements SourceService { @Override public Collection<String> getBranches(final Space space, final String repositoryName) { checkNotNull("repositoryName", repositoryName); final Repository repository = repositoryService.getRepositoryFromSpace(space, repositoryName); return repository != null ? toBranchNames(repository.getBranches()) : new ArrayList<>(); } SourceServiceImpl(); @Inject  SourceServiceImpl(OrganizationalUnitService organizationalUnitService,
                             RepositoryService repositoryService,
                             ModuleService<? extends Module> moduleService,
                             AuthorizationManager authorizationManager,
                             User identity); }
SourceServiceImpl implements SourceService { @Override public Collection<String> getBranches(final Space space, final String repositoryName) { checkNotNull("repositoryName", repositoryName); final Repository repository = repositoryService.getRepositoryFromSpace(space, repositoryName); return repository != null ? toBranchNames(repository.getBranches()) : new ArrayList<>(); } SourceServiceImpl(); @Inject  SourceServiceImpl(OrganizationalUnitService organizationalUnitService,
                             RepositoryService repositoryService,
                             ModuleService<? extends Module> moduleService,
                             AuthorizationManager authorizationManager,
                             User identity); @Override Collection<String> getOrganizationUnits(); @Override Collection<String> getRepositories(final String organizationalUnit); @Override Collection<String> getBranches(final Space space, final String repositoryName); @Override Collection<Module> getModules(final Space space,
                                         final String repositoryAlias,
                                         final String branchName); }
SourceServiceImpl implements SourceService { @Override public Collection<String> getBranches(final Space space, final String repositoryName) { checkNotNull("repositoryName", repositoryName); final Repository repository = repositoryService.getRepositoryFromSpace(space, repositoryName); return repository != null ? toBranchNames(repository.getBranches()) : new ArrayList<>(); } SourceServiceImpl(); @Inject  SourceServiceImpl(OrganizationalUnitService organizationalUnitService,
                             RepositoryService repositoryService,
                             ModuleService<? extends Module> moduleService,
                             AuthorizationManager authorizationManager,
                             User identity); @Override Collection<String> getOrganizationUnits(); @Override Collection<String> getRepositories(final String organizationalUnit); @Override Collection<String> getBranches(final Space space, final String repositoryName); @Override Collection<Module> getModules(final Space space,
                                         final String repositoryAlias,
                                         final String branchName);  }