Search in sources :

Example 1 with NewBranchEvent

use of org.guvnor.structure.repositories.NewBranchEvent in project kie-wb-common by kiegroup.

the class ProjectBranchBreadcrumbTest method newBranchCreatedByOtherUserShouldNotBeOpened.

@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);
}
Also used : User(org.jboss.errai.security.shared.api.identity.User) NewBranchEvent(org.guvnor.structure.repositories.NewBranchEvent) Test(org.junit.Test)

Example 2 with NewBranchEvent

use of org.guvnor.structure.repositories.NewBranchEvent in project kie-wb-common by kiegroup.

the class ProjectBranchBreadcrumbTest method newBranchCreatedByUserShouldBeOpened.

@Test
public void newBranchCreatedByUserShouldBeOpened() {
    doReturn(true).when(libraryPlaces).isThisUserAccessingThisRepository("user", repository);
    presenter.newBranchEvent(new NewBranchEvent(repository, newBranch.getName(), "old-branch", user.getIdentifier()));
    verify(libraryPlaces).goToProject(project, newBranch);
}
Also used : NewBranchEvent(org.guvnor.structure.repositories.NewBranchEvent) Test(org.junit.Test)

Aggregations

NewBranchEvent (org.guvnor.structure.repositories.NewBranchEvent)2 Test (org.junit.Test)2 User (org.jboss.errai.security.shared.api.identity.User)1