use of pro.taskana.exceptions.NotAuthorizedException in project taskana by Taskana.
the class QueryClassificationAccTest method testGetClassificationsForKeyAndCategories.
@Test
public void testGetClassificationsForKeyAndCategories() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery().keyIn("T2100", "L10000").categoryIn("EXTERNAL", "MANUAL").list();
assertNotNull(classifications);
assertEquals(5, classifications.size());
List<ClassificationSummary> externCategory = classifications.stream().filter(c -> c.getCategory().equals("EXTERNAL")).collect(Collectors.toList());
assertEquals(2, externCategory.size());
List<ClassificationSummary> manualCategory = classifications.stream().filter(c -> c.getCategory().equals("MANUAL")).collect(Collectors.toList());
assertEquals(3, manualCategory.size());
}
use of pro.taskana.exceptions.NotAuthorizedException in project taskana by Taskana.
the class WorkbasketQueryAccTest method testQueryWorkbasketByUnknownUser.
@WithAccessId(userName = "unknown")
@Test
public void testQueryWorkbasketByUnknownUser() throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%").list();
Assert.assertEquals(0L, results.size());
try {
results = workbasketService.createWorkbasketQuery().nameLike("%").accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2").list();
Assert.fail("NotAuthrorizedException was expected");
} catch (NotAuthorizedException ex) {
}
}
Aggregations