### Question:
ProjectBranchBreadcrumb implements BreadcrumbPresenter { public ProjectBranchBreadcrumb setup(final Collection<Branch> branches) { final Set<Branch> branchesSet = new HashSet<>(); final List<Promise<Boolean>> canReadBranchPromises = branches.stream().map(b -> projectController.canReadBranch(libraryPlaces.getActiveWorkspace(), b.getName()).then(canReadBranch -> { if (canReadBranch) { branchesSet.add(b); } return promises.resolve(true); })).collect(Collectors.toList()); promises.all(canReadBranchPromises.toArray(new Promise[canReadBranchPromises.size()])).then(ignored -> { this.branches = branchesSet.stream().sorted(BRANCH_ALPHABETICAL_ORDER_COMPARATOR).collect(Collectors.toList()); view.init(this); return promises.resolve(); }); return this; } @Inject  ProjectBranchBreadcrumb(final View view,
                                   final LibraryPlaces libraryPlaces,
                                   final Event<NotificationEvent> notificationEvent,
                                   final ProjectController projectController,
                                   final Promises promises); ProjectBranchBreadcrumb setup(final Collection<Branch> branches); @Override void activate(); @Override void deactivate(); Branch getCurrentBranch(); List<Branch> getBranches(); @Override UberElemental<? extends BreadcrumbPresenter> getView(); void onBranchChanged(final Branch branch); void newBranchEvent(@Observes final NewBranchEvent newBranchEvent); void repositoryUpdatedEvent(@Observes final RepositoryUpdatedEvent event); static final Comparator<Branch> BRANCH_ALPHABETICAL_ORDER_COMPARATOR; }### Answer:
@Test public void setupTest() { doReturn(promises.resolve(true)).when(projectController).canReadBranch(any(), any()); presenter.setup(repository.getBranches()); verify(view).init(presenter); final List<Branch> orderedBranches = presenter.getBranches(); assertEquals("branch1", (orderedBranches).get(0).getName()); assertEquals("branch2", (orderedBranches).get(1).getName()); assertEquals("branch3", (orderedBranches).get(2).getName()); assertEquals("branch4", (orderedBranches).get(3).getName()); }