@Test(expected = PermissionDeniedException.class) public void testUserWithoutPermission() { when(userGroupCallback.getGroupsForUser(USER_ID)).thenReturn(new ArrayList<String>()); when(peopleAssignments.getBusinessAdministrators()).thenReturn(new ArrayList<OrganizationalEntity>()); command.execute(taskContext); fail(); } }
@Test public void testUserOnPotentialOwnersGroups() { List<String> userGroups = new ArrayList<>(); userGroups.add("user"); when(userGroupCallback.getGroupsForUser(USER_ID)).thenReturn(userGroups); List<OrganizationalEntity> potentialOwners = new ArrayList<>(); potentialOwners.add(new GroupImpl("user")); when(peopleAssignments.getPotentialOwners()).thenReturn(potentialOwners); Task commandTask = command.execute(taskContext); assertEquals(task, commandTask); }
@Test public void testUserOnBusinessAdministratorGroups() { List<String> userGroups = new ArrayList<>(); userGroups.add("admin"); when(userGroupCallback.getGroupsForUser(USER_ID)).thenReturn(userGroups); List<OrganizationalEntity> admins = new ArrayList<>(); admins.add(new GroupImpl("admin")); when(peopleAssignments.getBusinessAdministrators()).thenReturn(admins); Task commandTask = command.execute(taskContext); assertEquals(task, commandTask); }
@Test(expected = IllegalStateException.class) public void testGetUnexistentClass() { when(taskQueryService.getTaskInstanceById(TASK_ID)).thenReturn(null); command.execute(taskContext); fail(); }