org.assertj.core.api.ThrowableAssert.ThrowingCallable Java Examples
The following examples show how to use
org.assertj.core.api.ThrowableAssert.ThrowingCallable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskanaSecurityConfigAccTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void should_ThrowException_When_CreatingUnsecuredEngineCfgWhileSecurityIsEnforced() throws SQLException { setSecurityFlag(true); ThrowingCallable createUnsecuredTaskanaEngineConfiguration = () -> { TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration( TaskanaEngineTestConfiguration.getDataSource(), false, false, TaskanaEngineTestConfiguration.getSchemaName()); }; assertThatThrownBy(createUnsecuredTaskanaEngineConfiguration) .isInstanceOf(SystemException.class) .hasMessageContaining("Secured TASKANA mode is enforced, can't start in unsecured mode"); }
Example #2
Source File: UpdateTaskAttachmentsAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "user-1-1") @Test void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException() throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, NotAuthorizedException, AttachmentPersistenceException, InvalidStateException { final int attachmentCount = 0; task.getAttachments().clear(); task = taskService.updateTask(task); task = taskService.getTask(task.getId()); assertThat(task.getAttachments()).hasSize(attachmentCount); AttachmentImpl attachment = (AttachmentImpl) this.attachment; attachment.setId("TAI:000017"); task.getAttachments().add(attachment); task.getAttachments().add(attachment); ThrowingCallable call = () -> taskService.updateTask(task); assertThatThrownBy(call).isInstanceOf(AttachmentPersistenceException.class); }
Example #3
Source File: ServiceLevelPriorityAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "user-1-1") @Test void should_ThrowException_When_DueAndPlannedAreInconsistent() { Task newTask = taskService.newTask("USER-1-1", "DOMAIN_A"); Instant planned = moveForwardToWorkingDay(Instant.now().plus(2, ChronoUnit.HOURS)); newTask.setClassificationKey("T2100"); // P10D newTask.setPrimaryObjRef( createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567")); newTask.setOwner("user-1-1"); newTask.setPlanned(planned); newTask.setDue(planned); // due date not according to service level ThrowingCallable call = () -> taskService.createTask(newTask); assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class); }
Example #4
Source File: DeleteTaskCommentAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "user-1-2", groups = "user-1-1") // to read comments @Test void should_FailToDeleteTaskComment_When_UserHasNoAuthorization() throws NotAuthorizedException, TaskNotFoundException { TaskService taskService = taskanaEngine.getTaskService(); List<TaskComment> taskComments = taskService.getTaskComments("TKI:000000000000000000000000000000000000"); assertThat(taskComments).hasSize(3); ThrowingCallable lambda = () -> taskService.deleteTaskComment("TCI:000000000000000000000000000000000000"); assertThatThrownBy(lambda).isInstanceOf(NotAuthorizedException.class); // make sure the task comment was not deleted List<TaskComment> taskCommentsAfterDeletion = taskService.getTaskComments("TKI:000000000000000000000000000000000000"); assertThat(taskCommentsAfterDeletion).hasSize(3); }
Example #5
Source File: DeleteWorkbasketAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "businessadmin") @Test void testDeleteWorkbasketWithNullOrEmptyParam() { // Test Null-Value ThrowingCallable call = () -> { workbasketService.deleteWorkbasket(null); }; assertThatThrownBy(call) .describedAs( "delete() should have thrown an InvalidArgumentException, " + "when the param ID is null.") .isInstanceOf(InvalidArgumentException.class); // Test EMPTY-Value call = () -> { workbasketService.deleteWorkbasket(""); }; assertThatThrownBy(call) .describedAs( "delete() should have thrown an InvalidArgumentException, \"\n" + " + \"when the param ID is EMPTY-String.") .isInstanceOf(InvalidArgumentException.class); }
Example #6
Source File: WorkbasketServiceImplTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void testCheckModifiedHasNotChanged() { Instant expectedModifiedTimestamp = Instant.now(); WorkbasketImpl oldWb = createTestWorkbasket(null, "Key-1"); WorkbasketImpl workbasketImplToUpdate = createTestWorkbasket(null, "Key-2"); oldWb.setModified(expectedModifiedTimestamp); workbasketImplToUpdate.setModified(expectedModifiedTimestamp); ThrowingCallable call = () -> workbasketServiceSpy.checkModifiedHasNotChanged(oldWb, workbasketImplToUpdate); assertThatCode(call).doesNotThrowAnyException(); workbasketImplToUpdate.setModified(expectedModifiedTimestamp.minus(1, ChronoUnit.HOURS)); call = () -> workbasketServiceSpy.checkModifiedHasNotChanged(oldWb, workbasketImplToUpdate); assertThatThrownBy(call).isInstanceOf(ConcurrencyException.class); }
Example #7
Source File: TaskanaSecurityConfigAccTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void should_SetSecurityFlagToFalse_When_CreatingUnsecureEngineCfgAndSecurityFlagIsNotSet() throws SQLException { assertThat(retrieveSecurityFlag()).isNull(); ThrowingCallable createUnsecuredTaskanaEngineConfiguration = () -> { TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration( TaskanaEngineTestConfiguration.getDataSource(), false, false, TaskanaEngineTestConfiguration.getSchemaName()); }; assertThatCode(createUnsecuredTaskanaEngineConfiguration).doesNotThrowAnyException(); assertThat(retrieveSecurityFlag()).isFalse(); }
Example #8
Source File: TransferTaskAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "teamlead-1") @Test void should_ThrowException_When_BulkTransferTasksWithoutAppendPermissionOnTarget() { TaskService taskService = taskanaEngine.getTaskService(); ArrayList<String> taskIdList = new ArrayList<>(); taskIdList.add("TKI:000000000000000000000000000000000006"); // working taskIdList.add("TKI:000000000000000000000000000000000041"); // NotAuthorized READ ThrowingCallable call = () -> { taskService.transferTasks("WBI:100000000000000000000000000000000010", taskIdList); }; assertThatThrownBy(call) .isInstanceOf(NotAuthorizedException.class) .hasMessageContaining("APPEND"); }
Example #9
Source File: WorkbasketControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException() { String workbasketId = "WBI:100004857400039500000999999999999999"; ThrowingCallable httpCall = () -> { TEMPLATE.exchange( restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketId), HttpMethod.GET, new HttpEntity<String>(restHelper.getHeadersBusinessAdmin()), ParameterizedTypeReference.forType(WorkbasketRepresentationModel.class)); }; assertThatThrownBy(httpCall) .isInstanceOf(HttpClientErrorException.class) .extracting(ex -> ((HttpClientErrorException) ex).getStatusCode()) .isEqualTo(HttpStatus.NOT_FOUND); }
Example #10
Source File: DeleteTaskAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "admin") @Test void testBulkDeleteTask() throws InvalidArgumentException, NotAuthorizedException { TaskService taskService = taskanaEngine.getTaskService(); ArrayList<String> taskIdList = new ArrayList<>(); taskIdList.add("TKI:000000000000000000000000000000000037"); taskIdList.add("TKI:000000000000000000000000000000000038"); BulkOperationResults<String, TaskanaException> results = taskService.deleteTasks(taskIdList); assertThat(results.containsErrors()).isFalse(); ThrowingCallable call = () -> { taskService.getTask("TKI:000000000000000000000000000000000038"); }; assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class); }
Example #11
Source File: CreateWorkbasketAuthorizationsAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "user-1-1") @WithAccessId(user = "taskadmin") @TestTemplate void should_ThrowException_When_UserRoleIsNotAdminOrBusinessAdmin() { WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem( "WBI:100000000000000000000000000000000001", "user1"); accessItem.setPermAppend(true); accessItem.setPermCustom11(true); accessItem.setPermRead(true); ThrowingCallable call = () -> { workbasketService.createWorkbasketAccessItem(accessItem); }; assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class); }
Example #12
Source File: DeleteTaskCommentAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "user-1-1") @Test void should_FailToDeleteTaskComment_When_TaskCommentIsNotExisting() throws NotAuthorizedException, TaskNotFoundException { TaskService taskService = taskanaEngine.getTaskService(); List<TaskComment> taskComments = taskService.getTaskComments("TKI:000000000000000000000000000000000000"); assertThat(taskComments).hasSize(3); ThrowingCallable lambda = () -> taskService.deleteTaskComment("non existing task comment id"); assertThatThrownBy(lambda).isInstanceOf(TaskCommentNotFoundException.class); // make sure the task comment was not deleted List<TaskComment> taskCommentsAfterDeletion = taskService.getTaskComments("TKI:000000000000000000000000000000000000"); assertThat(taskCommentsAfterDeletion).hasSize(3); }
Example #13
Source File: WorkbasketDefinitionControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void testImportWorkbasketWithDistributionTargetsNotInSystem() { TaskanaPagedModel<WorkbasketDefinitionRepresentationModel> wbList = executeExportRequestForDomain("DOMAIN_A").getBody(); assertThat(wbList).isNotNull(); WorkbasketDefinitionRepresentationModel w = wbList.getContent().iterator().next(); w.setDistributionTargets(Collections.singleton("invalidWorkbasketId")); ThrowingCallable httpCall = () -> expectStatusWhenExecutingImportRequestOfWorkbaskets(HttpStatus.BAD_REQUEST, w); assertThatThrownBy(httpCall) .isInstanceOf(HttpClientErrorException.class) .extracting(e -> (HttpClientErrorException) e) .extracting(HttpStatusCodeException::getStatusCode) .isEqualTo(HttpStatus.BAD_REQUEST); w.getWorkbasket().setKey("anotherNewKey"); assertThatThrownBy(httpCall) .isInstanceOf(HttpClientErrorException.class) .extracting(e -> (HttpClientErrorException) e) .extracting(HttpStatusCodeException::getStatusCode) .isEqualTo(HttpStatus.BAD_REQUEST); }
Example #14
Source File: TaskanaSecurityConfigAccTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void should_SetSecurityFlagToTrue_When_CreatingSecureEngineCfgAndSecurityFlagIsNotSet() throws SQLException { assertThat(retrieveSecurityFlag()).isNull(); ThrowingCallable createSecuredTaskanaEngineConfiguration = () -> { TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration( TaskanaEngineTestConfiguration.getDataSource(), false, true, TaskanaEngineTestConfiguration.getSchemaName()); }; assertThatCode(createSecuredTaskanaEngineConfiguration).doesNotThrowAnyException(); assertThat(retrieveSecurityFlag()).isTrue(); }
Example #15
Source File: ClassificationControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Test @DirtiesContext void testReturn400IfCreateClassificationWithIncompatibleParentIdAndKey() { String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\"," + "\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\"," + "\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\"," + "\"parentKey\":\"T2000\"}"; ThrowingCallable httpCall = () -> { template.exchange( restHelper.toUrl(Mapping.URL_CLASSIFICATIONS), HttpMethod.POST, new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin()), ParameterizedTypeReference.forType(ClassificationRepresentationModel.class)); }; assertThatThrownBy(httpCall) .isInstanceOf(HttpClientErrorException.class) .extracting(ex -> ((HttpClientErrorException) ex).getStatusCode()) .isEqualTo(HttpStatus.BAD_REQUEST); }
Example #16
Source File: QueryTasksAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "admin") @Test void testQueryForCustom7WithExceptionInIn() throws InvalidArgumentException { List<TaskSummary> results = taskService.createTaskQuery().customAttributeLike("7", "fsdhfshk%").list(); assertThat(results).isEmpty(); String[] ids = results.stream().map(wrap(t -> t.getCustomAttribute("7"))).toArray(String[]::new); ThrowingCallable call = () -> { List<TaskSummary> result2 = taskService.createTaskQuery().customAttributeIn("7", ids).list(); assertThat(result2).isEmpty(); }; assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class); }
Example #17
Source File: DeleteTaskAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "admin") @Test void testForceDeleteTaskIfNotCompleted() throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { TaskService taskService = taskanaEngine.getTaskService(); Task task = taskService.getTask("TKI:000000000000000000000000000000000027"); ThrowingCallable call = () -> { taskService.deleteTask(task.getId()); }; assertThatThrownBy(call) .describedAs("Should not be possible to delete claimed task without force flag") .isInstanceOf(InvalidStateException.class); taskService.forceDeleteTask(task.getId()); call = () -> { taskService.getTask("TKI:000000000000000000000000000000000027"); }; assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class); }
Example #18
Source File: TaskCommentControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void should_FailToReturnTaskComment_When_TaskCommentIsNotExisting() { String urlToNonExistingTaskComment = restHelper.toUrl(Mapping.URL_TASK_COMMENT, "Non existing task comment Id"); ThrowingCallable httpCall = () -> { template.exchange( urlToNonExistingTaskComment, HttpMethod.GET, new HttpEntity<String>(restHelper.getHeadersAdmin()), ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class)); }; assertThatThrownBy(httpCall) .extracting(ex -> ((HttpClientErrorException) ex).getStatusCode()) .isEqualTo(HttpStatus.NOT_FOUND); }
Example #19
Source File: TaskCommentControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Disabled("Disabled until Authorization check is up!") @Test void should_FailToReturnTaskComments_When_TaskIstNotVisible() { String urlToNotVisibleTask = restHelper.toUrl(Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000004"); ThrowingCallable httpCall = () -> { template.exchange( urlToNotVisibleTask, HttpMethod.GET, new HttpEntity<String>(restHelper.getHeadersUser_1_1()), TASK_COMMENT_PAGE_MODEL_TYPE); }; assertThatThrownBy(httpCall) .extracting(ex -> ((HttpClientErrorException) ex).getStatusCode()) .isEqualTo(HttpStatus.FORBIDDEN); }
Example #20
Source File: TaskCommentControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Disabled("Disabled until Authorization check is up!") @Test void should_FailToReturnTaskComment_When_TaskIstNotVisible() { String urlToNotVisibleTask = restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000012"); ThrowingCallable httpCall = () -> { template.exchange( urlToNotVisibleTask, HttpMethod.GET, new HttpEntity<String>(restHelper.getHeadersUser_1_2()), ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class)); }; assertThatThrownBy(httpCall) .extracting(ex -> ((HttpClientErrorException) ex).getStatusCode()) .isEqualTo(HttpStatus.FORBIDDEN); }
Example #21
Source File: TaskCommentControllerIntTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void should_FailToCreateTaskComment_When_TaskIdIsNonExisting() { TaskCommentRepresentationModel taskCommentRepresentationModelToCreate = new TaskCommentRepresentationModel(); taskCommentRepresentationModelToCreate.setTaskId("DefinatelyNotExistingId"); taskCommentRepresentationModelToCreate.setTextField("newly created task comment"); ThrowingCallable httpCall = () -> { template.exchange( restHelper.toUrl(Mapping.URL_TASK_GET_POST_COMMENTS, "DefinatelyNotExistingId"), HttpMethod.POST, new HttpEntity<>( taskCommentRepresentationModelToCreate, restHelper.getHeadersAdmin()), ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class)); }; assertThatThrownBy(httpCall) .extracting(ex -> ((HttpClientErrorException) ex).getStatusCode()) .isEqualTo(HttpStatus.NOT_FOUND); }
Example #22
Source File: TransferTaskAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "teamlead-1", groups = GROUP_1_DN) @Test void should_ThrowException_When_TransferTasksWithInvalidTasksIdList() { TaskService taskService = taskanaEngine.getTaskService(); // test with invalid list ThrowingCallable call = () -> { taskService.transferTasks("WBI:100000000000000000000000000000000006", null); }; assertThatThrownBy(call) .isInstanceOf(InvalidArgumentException.class) .hasMessage("TaskIds must not be null."); // test with list containing only invalid arguments call = () -> { taskService.transferTasks( "WBI:100000000000000000000000000000000006", Arrays.asList("", "", "", null)); }; assertThatThrownBy(call) .isInstanceOf(InvalidArgumentException.class) .hasMessage("TaskIds must not contain only invalid arguments."); }
Example #23
Source File: CreateWorkbasketAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "businessadmin") @Test void testCreateWorkbasketWithAlreadyExistingKeyAndDomainAndEmptyIdUpdatesOlderWorkbasket() throws DomainNotFoundException, InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException { WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); // First create a new Workbasket. Workbasket wb = workbasketService.newWorkbasket("newKey", "DOMAIN_A"); wb.setType(WorkbasketType.GROUP); wb.setName("this name"); workbasketService.createWorkbasket(wb); // Second create a new Workbasket with same Key and Domain. Workbasket sameKeyAndDomain = workbasketService.newWorkbasket("newKey", "DOMAIN_A"); sameKeyAndDomain.setType(WorkbasketType.TOPIC); sameKeyAndDomain.setName("new name"); ThrowingCallable call = () -> { workbasketService.createWorkbasket(sameKeyAndDomain); }; assertThatThrownBy(call).isInstanceOf(WorkbasketAlreadyExistException.class); }
Example #24
Source File: CreateWorkbasketAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "businessadmin") @Test void testThrowsExceptionIfWorkbasketWithCaseInsensitiveSameKeyDomainIsCreated() throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); Workbasket workbasket = workbasketService.newWorkbasket("X123456", "DOMAIN_A"); workbasket.setName("Personal Workbasket for UID X123456"); workbasket.setType(WorkbasketType.PERSONAL); workbasketService.createWorkbasket(workbasket); Workbasket duplicateWorkbasketWithSmallX = workbasketService.newWorkbasket("x123456", "DOMAIN_A"); duplicateWorkbasketWithSmallX.setName("Personal Workbasket for UID X123456"); duplicateWorkbasketWithSmallX.setType(WorkbasketType.PERSONAL); ThrowingCallable call = () -> { workbasketService.createWorkbasket(duplicateWorkbasketWithSmallX); }; assertThatThrownBy(call).isInstanceOf(WorkbasketAlreadyExistException.class); }
Example #25
Source File: GetTaskIdsOfCustomFieldValueReportAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "monitor") @Test void testThrowsExceptionIfSubKeysAreUsed() { final MonitorService monitorService = taskanaEngine.getMonitorService(); final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders(); final List<SelectedItem> selectedItems = new ArrayList<>(); SelectedItem s1 = new SelectedItem(); s1.setKey("Geschaeftsstelle A"); s1.setSubKey("INVALID"); s1.setLowerAgeLimit(-5); s1.setUpperAgeLimit(-2); selectedItems.add(s1); ThrowingCallable call = () -> { monitorService .createCategoryReportBuilder() .withColumnHeaders(columnHeaders) .listTaskIdsForSelectedItems(selectedItems); }; assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class); }
Example #26
Source File: TransferTaskAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "user-1-1", groups = GROUP_1_DN) @Test void should_ThrowException_When_TransferWithNoAppendAuthorization() throws NotAuthorizedException, TaskNotFoundException { TaskService taskService = taskanaEngine.getTaskService(); Task task = taskService.getTask("TKI:000000000000000000000000000000000002"); ThrowingCallable call = () -> { taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000008"); }; assertThatThrownBy(call) .isInstanceOf(NotAuthorizedException.class) .extracting(Throwable::getMessage) .asString() .startsWith( "Not authorized. Permission 'APPEND' on workbasket " + "'WBI:100000000000000000000000000000000008' is needed."); }
Example #27
Source File: WorkbasketQueryAccTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void testQueryWorkbasketByUnauthenticated() { WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery().nameLike("%").list(); assertThat(results).isEmpty(); ThrowingCallable call = () -> { workbasketService .createWorkbasketQuery() .nameLike("%") .accessIdsHavePermission( WorkbasketPermission.TRANSFER, "teamlead-1", GROUP_1_DN, GROUP_2_DN) .list(); }; assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class); }
Example #28
Source File: TaskanaSecurityConfigAccTest.java From taskana with Apache License 2.0 | 6 votes |
@Test void should_StartUpNormally_When_CreatingUnsecuredEngineCfgWhileSecurityIsNotEnforced() throws SQLException { setSecurityFlag(false); ThrowingCallable createUnsecuredTaskanaEngineConfiguration = () -> { TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration( TaskanaEngineTestConfiguration.getDataSource(), false, false, TaskanaEngineTestConfiguration.getSchemaName()); }; assertThatCode(createUnsecuredTaskanaEngineConfiguration).doesNotThrowAnyException(); }
Example #29
Source File: TransferTaskAccTest.java From taskana with Apache License 2.0 | 6 votes |
@WithAccessId(user = "teamlead-1", groups = GROUP_1_DN) @Test void should_ThrowException_When_DestinationWorkbasketDoesNotExist() throws NotAuthorizedException, TaskNotFoundException, InvalidStateException, InvalidOwnerException { TaskService taskService = taskanaEngine.getTaskService(); Task task = taskService.getTask("TKI:000000000000000000000000000000000003"); taskService.claim(task.getId()); taskService.setTaskRead(task.getId(), true); ThrowingCallable call = () -> { taskService.transfer(task.getId(), "INVALID"); }; assertThatThrownBy(call).isInstanceOf(WorkbasketNotFoundException.class); }
Example #30
Source File: GetTaskCommentAccTest.java From taskana with Apache License 2.0 | 5 votes |
@WithAccessId(user = "user-1-1") @Test void should_FailToReturnTaskComment_When_TaskCommentIsNotExisting() { TaskService taskService = taskanaEngine.getTaskService(); ThrowingCallable lambda = () -> taskService.getTaskComment("Definately Non Existing Task Comment Id"); assertThatThrownBy(lambda).isInstanceOf(TaskCommentNotFoundException.class); }