@Test public void newBranchCreatedByOtherUserShouldNotBeOpened() { final User otherUser = mock(User.class); when(otherUser.getIdentifier()).thenReturn("otherUser"); doReturn(false).when(libraryPlaces).isThisUserAccessingThisRepository("otherUser", repository); presenter.newBranchEvent(new NewBranchEvent(repository, newBranch.getName(), "old-branch", otherUser.getIdentifier())); verify(libraryPlaces, never()).goToProject(project, newBranch); }
public void newBranchEvent(@Observes final NewBranchEvent newBranchEvent) { final String userIdentifier = newBranchEvent.getUserIdentifier(); final Repository repository = newBranchEvent.getRepository(); if (libraryPlaces.isThisUserAccessingThisRepository(userIdentifier, repository)) { libraryPlaces.goToProject(libraryPlaces.getActiveWorkspace(), repository.getBranch(newBranchEvent.getNewBranchName()).get()); } }
ProjectBranchBreadcrumb implements BreadcrumbPresenter { public void newBranchEvent(@Observes final NewBranchEvent newBranchEvent) { final String userIdentifier = newBranchEvent.getUserIdentifier(); final Repository repository = newBranchEvent.getRepository(); if (libraryPlaces.isThisUserAccessingThisRepository(userIdentifier, repository)) { libraryPlaces.goToProject(libraryPlaces.getActiveWorkspace(), repository.getBranch(newBranchEvent.getNewBranchName()).get()); } } }
ProjectBranchBreadcrumb implements BreadcrumbPresenter { public void newBranchEvent(@Observes final NewBranchEvent newBranchEvent) { final String userIdentifier = newBranchEvent.getUserIdentifier(); final Repository repository = newBranchEvent.getRepository(); if (libraryPlaces.isThisUserAccessingThisRepository(userIdentifier, repository)) { libraryPlaces.goToProject(libraryPlaces.getActiveWorkspace(), repository.getBranch(newBranchEvent.getNewBranchName()).get()); } } @Inject  ProjectBranchBreadcrumb(final View view,
                                   final LibraryPlaces libraryPlaces,
                                   final Event<NotificationEvent> notificationEvent,
                                   final ProjectController projectController,
                                   final Promises promises); }
ProjectBranchBreadcrumb implements BreadcrumbPresenter { public void newBranchEvent(@Observes final NewBranchEvent newBranchEvent) { final String userIdentifier = newBranchEvent.getUserIdentifier(); final Repository repository = newBranchEvent.getRepository(); if (libraryPlaces.isThisUserAccessingThisRepository(userIdentifier, repository)) { libraryPlaces.goToProject(libraryPlaces.getActiveWorkspace(), repository.getBranch(newBranchEvent.getNewBranchName()).get()); } } @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); }
ProjectBranchBreadcrumb implements BreadcrumbPresenter { public void newBranchEvent(@Observes final NewBranchEvent newBranchEvent) { final String userIdentifier = newBranchEvent.getUserIdentifier(); final Repository repository = newBranchEvent.getRepository(); if (libraryPlaces.isThisUserAccessingThisRepository(userIdentifier, repository)) { libraryPlaces.goToProject(libraryPlaces.getActiveWorkspace(), repository.getBranch(newBranchEvent.getNewBranchName()).get()); } } @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; }