Closes #2604 - updated assertJ code to remove deprecation notices

This commit is contained in:
Holger Hagen 2024-07-17 18:28:14 +02:00
parent 952c93a22e
commit 8bfa9e730a
20 changed files with 153 additions and 166 deletions

View File

@ -62,7 +62,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call = () -> classificationService.getClassification(classification.getId());
ClassificationNotFoundException e =
catchThrowableOfType(call, ClassificationNotFoundException.class);
catchThrowableOfType(ClassificationNotFoundException.class, call);
assertThat(e.getClassificationId()).isEqualTo(classification.getId());
}
@ -79,7 +79,7 @@ class DeleteClassificationAccTest {
classificationService.deleteClassification(
classification.getKey(), classification.getDomain());
NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
NotAuthorizedException e = catchThrowableOfType(NotAuthorizedException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getRoles())
.containsExactlyInAnyOrder(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -95,7 +95,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call =
() -> classificationService.deleteClassification(classification.getId());
NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
NotAuthorizedException e = catchThrowableOfType(NotAuthorizedException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getRoles())
.containsExactlyInAnyOrder(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -115,7 +115,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call =
() -> classificationService.deleteClassification(classification.getId());
ClassificationInUseException e = catchThrowableOfType(call, ClassificationInUseException.class);
ClassificationInUseException e = catchThrowableOfType(ClassificationInUseException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(classification.getKey());
assertThat(e.getDomain()).isEqualTo(classification.getDomain());
}
@ -134,7 +134,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call =
() -> classificationService.deleteClassification(classification.getKey(), MASTER_DOMAIN);
ClassificationInUseException e = catchThrowableOfType(call, ClassificationInUseException.class);
ClassificationInUseException e = catchThrowableOfType(ClassificationInUseException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(classification.getKey());
assertThat(e.getDomain()).isEqualTo(classification.getDomain());
}
@ -156,7 +156,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call = () -> classificationService.getClassification(child.getId());
ClassificationNotFoundException e =
catchThrowableOfType(call, ClassificationNotFoundException.class);
catchThrowableOfType(ClassificationNotFoundException.class, call);
assertThat(e.getClassificationId()).isEqualTo(child.getId());
}
@ -173,7 +173,7 @@ class DeleteClassificationAccTest {
classification.getKey(), classification.getDomain());
ClassificationNotFoundException e =
catchThrowableOfType(call, ClassificationNotFoundException.class);
catchThrowableOfType(ClassificationNotFoundException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(classification.getKey());
assertThat(e.getDomain()).isEqualTo(classification.getDomain());
}
@ -201,7 +201,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call =
() -> classificationService.deleteClassification(attachmentClassification.getId());
ClassificationInUseException e = catchThrowableOfType(call, ClassificationInUseException.class);
ClassificationInUseException e = catchThrowableOfType(ClassificationInUseException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(attachmentClassification.getKey());
assertThat(e.getDomain()).isEqualTo(attachmentClassification.getDomain());
}
@ -223,7 +223,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call = () -> classificationService.deleteClassification(parent.getId());
ClassificationInUseException e = catchThrowableOfType(call, ClassificationInUseException.class);
ClassificationInUseException e = catchThrowableOfType(ClassificationInUseException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(child.getKey());
assertThat(e.getDomain()).isEqualTo(child.getDomain());
Classification rollback =
@ -252,7 +252,7 @@ class DeleteClassificationAccTest {
ThrowingCallable call =
() -> classificationService.deleteClassification(parent.getKey(), MASTER_DOMAIN);
ClassificationInUseException e = catchThrowableOfType(call, ClassificationInUseException.class);
ClassificationInUseException e = catchThrowableOfType(ClassificationInUseException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(child.getKey());
assertThat(e.getDomain()).isEqualTo(child.getDomain());
Classification rollbackMaster =
@ -272,7 +272,7 @@ class DeleteClassificationAccTest {
"not existing classification key", MASTER_DOMAIN);
ClassificationNotFoundException e =
catchThrowableOfType(call, ClassificationNotFoundException.class);
catchThrowableOfType(ClassificationNotFoundException.class, call);
assertThat(e.getClassificationKey()).isEqualTo("not existing classification key");
assertThat(e.getDomain()).isEqualTo(MASTER_DOMAIN);
}
@ -288,7 +288,7 @@ class DeleteClassificationAccTest {
() -> classificationService.deleteClassification(classification.getKey(), "DOMAIN_B");
ClassificationNotFoundException e =
catchThrowableOfType(call, ClassificationNotFoundException.class);
catchThrowableOfType(ClassificationNotFoundException.class, call);
assertThat(e.getClassificationKey()).isEqualTo(classification.getKey());
assertThat(e.getDomain()).isEqualTo("DOMAIN_B");
}

View File

@ -178,7 +178,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.claim(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getTaskId()).isEqualTo(task.getId());
}
@ -198,7 +198,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.claim(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getTaskId()).isEqualTo(task.getId());
}
@ -315,7 +315,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.forceClaim(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())
@ -345,7 +345,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.claim(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-taskrouter");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getRequiredPermissions())
@ -459,7 +459,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.cancelClaim(claimedTask.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getTaskId()).isEqualTo(claimedTask.getId());
}
@ -479,7 +479,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.cancelClaim(claimedTask.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("taskadmin");
assertThat(e.getTaskId()).isEqualTo(claimedTask.getId());
}
@ -514,7 +514,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.cancelClaim(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())
@ -603,7 +603,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.forceCancelClaim(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())
@ -686,7 +686,7 @@ class ClaimTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.claim(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())

View File

@ -116,7 +116,7 @@ class SetOwnerAccTest {
ThrowingCallable call2 = () -> setOwner(taskReadyForReview, anyUserName);
NotAuthorizedOnWorkbasketException e2 =
catchThrowableOfType(call2, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call2);
assertThat(e2.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e2.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e2.getRequiredPermissions())
@ -138,7 +138,7 @@ class SetOwnerAccTest {
ThrowingCallable call = () -> setOwner(taskClaimed, anyUserName);
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getTaskId()).isEqualTo(taskClaimed.getId());
assertThat(e.getTaskState()).isEqualTo(TaskState.CLAIMED);
assertThat(e.getRequiredTaskStates())

View File

@ -136,7 +136,7 @@ class CancelTaskAccTest {
ThrowingCallable call = () -> taskService.cancelTask(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getRequiredPermissions())
.containsExactly(WorkbasketPermission.READ, WorkbasketPermission.READTASKS);
assertThat(e.getCurrentUserId()).isEqualTo("user-taskrouter");
@ -176,7 +176,7 @@ class CancelTaskAccTest {
t -> {
ThrowingCallable call = () -> taskService.cancelTask(t.getMiddle().getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getRequiredTaskStates())
.containsExactlyInAnyOrder(
TaskState.READY,

View File

@ -262,7 +262,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.forceCompleteTask(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())
@ -299,7 +299,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.completeTask(claimedTask.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo(currentUserContext.getUserid());
WorkbasketSummary workbasket = claimedTask.getWorkbasketSummary();
assertThat(e.getWorkbasketId()).isEqualTo(workbasket.getId());
@ -314,7 +314,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.completeTask(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getTaskId()).isEqualTo(task.getId());
assertThat(e.getTaskState()).isEqualTo(task.getState());
assertThat(e.getRequiredTaskStates())
@ -328,7 +328,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.completeTask(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getTaskId()).isEqualTo(task.getId());
}
@ -408,7 +408,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.forceClaim(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getTaskId()).isEqualTo(task.getId());
assertThat(e.getTaskState()).isEqualTo(task.getState());
assertThat(e.getRequiredTaskStates())
@ -422,7 +422,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.claim(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getTaskId()).isEqualTo(task.getId());
}
@ -438,7 +438,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.forceCancelClaim(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getTaskId()).isEqualTo(task.getId());
assertThat(e.getTaskState()).isEqualTo(task.getState());
assertThat(e.getRequiredTaskStates())
@ -479,7 +479,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.cancelClaim(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getTaskId()).isEqualTo(task.getId());
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
}
@ -803,7 +803,7 @@ class CompleteTaskAccTest implements TaskanaConfigurationModifier {
ThrowingCallable call = () -> taskService.completeTask(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())

View File

@ -113,7 +113,7 @@ class TerminateTaskAccTest {
ThrowingCallable call = () -> taskService.terminateTask(task.getId());
NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
NotAuthorizedException e = catchThrowableOfType(NotAuthorizedException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo(currentUserContext.getUserid());
assertThat(e.getRoles()).containsExactlyInAnyOrder(TaskanaRole.ADMIN, TaskanaRole.TASK_ADMIN);
}
@ -151,7 +151,7 @@ class TerminateTaskAccTest {
t -> {
ThrowingCallable call = () -> taskService.terminateTask(t.getMiddle().getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getRequiredTaskStates())
.containsExactlyInAnyOrder(
TaskState.READY,

View File

@ -253,7 +253,7 @@ class CreateTaskAccTest {
task2.setExternalId("MyExternalId");
ThrowingCallable call = () -> taskService.createTask(task2);
TaskAlreadyExistException e = catchThrowableOfType(call, TaskAlreadyExistException.class);
TaskAlreadyExistException e = catchThrowableOfType(TaskAlreadyExistException.class, call);
assertThat(e.getExternalId()).isEqualTo("MyExternalId");
}
@ -505,7 +505,7 @@ class CreateTaskAccTest {
task.setOwner("user-1-2");
ThrowingCallable call = () -> taskService.createTask(task);
WorkbasketNotFoundException e = catchThrowableOfType(call, WorkbasketNotFoundException.class);
WorkbasketNotFoundException e = catchThrowableOfType(WorkbasketNotFoundException.class, call);
assertThat(e.getId()).isEqualTo("UNKNOWN");
}
@ -523,7 +523,7 @@ class CreateTaskAccTest {
ThrowingCallable call = () -> taskService.createTask(task);
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getRequiredPermissions()).contains(WorkbasketPermission.APPEND);
@ -613,7 +613,7 @@ class CreateTaskAccTest {
ThrowingCallable call = () -> taskService.createTask(task);
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getCurrentUserId()).isEqualTo(null);
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);
@ -636,7 +636,7 @@ class CreateTaskAccTest {
ThrowingCallable call = () -> taskService.createTask(task);
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getRequiredPermissions()).containsExactly(WorkbasketPermission.READ);
@ -669,7 +669,7 @@ class CreateTaskAccTest {
workbasketService.deleteWorkbasket(newWorkbasketSummary.getId());
ThrowingCallable call = () -> taskService.createTask(testTask);
WorkbasketNotFoundException e = catchThrowableOfType(call, WorkbasketNotFoundException.class);
WorkbasketNotFoundException e = catchThrowableOfType(WorkbasketNotFoundException.class, call);
assertThat(e.getId()).isEqualTo(newWorkbasketSummary.getId());
}
@ -729,7 +729,7 @@ class CreateTaskAccTest {
ThrowingCallable call = () -> taskService.createTask(task);
ClassificationNotFoundException e =
catchThrowableOfType(call, ClassificationNotFoundException.class);
catchThrowableOfType(ClassificationNotFoundException.class, call);
assertThat(e.getClassificationKey()).isEqualTo("NOT_EXISTING");
assertThat(e.getDomain()).isEqualTo(defaultClassificationSummary.getDomain());
}

View File

@ -132,7 +132,7 @@ class DeleteTaskAccTest {
void should_ThrowException_When_UserIsNotInAdminRoleButTriesToBulkDeleteTasks() {
ThrowingCallable call = () -> taskService.deleteTasks(List.of(task1.getId(), task2.getId()));
NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
NotAuthorizedException e = catchThrowableOfType(NotAuthorizedException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo(taskanaEngine.getCurrentUserContext().getUserid());
assertThat(e.getRoles()).containsExactly(TaskanaRole.ADMIN);
}
@ -145,7 +145,7 @@ class DeleteTaskAccTest {
ThrowingCallable call = () -> taskService.getTask(task1.getId());
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo(task1.getId());
}
@ -156,7 +156,7 @@ class DeleteTaskAccTest {
void should_ThrowException_When_UserIsNotInAdminRole() {
ThrowingCallable call = () -> taskService.deleteTask(task1.getId());
NotAuthorizedException e = catchThrowableOfType(call, NotAuthorizedException.class);
NotAuthorizedException e = catchThrowableOfType(NotAuthorizedException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo(taskanaEngine.getCurrentUserContext().getUserid());
assertThat(e.getRoles()).containsExactly(TaskanaRole.ADMIN);
}
@ -174,7 +174,7 @@ class DeleteTaskAccTest {
ThrowingCallable call = () -> taskService.deleteTask(taskNotComplete.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getTaskId()).isEqualTo(taskNotComplete.getId());
assertThat(e.getTaskState()).isEqualTo(TaskState.READY);
assertThat(e.getRequiredTaskStates())
@ -195,7 +195,7 @@ class DeleteTaskAccTest {
taskService.forceDeleteTask(taskNotComplete.getId());
ThrowingCallable call = () -> taskService.getTask(taskNotComplete.getId());
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo(taskNotComplete.getId());
}
@ -210,11 +210,11 @@ class DeleteTaskAccTest {
assertThat(results.containsErrors()).isFalse();
ThrowingCallable call = () -> taskService.getTask(task1.getId());
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo(task1.getId());
ThrowingCallable call2 = () -> taskService.getTask(task2.getId());
TaskNotFoundException e2 = catchThrowableOfType(call2, TaskNotFoundException.class);
TaskNotFoundException e2 = catchThrowableOfType(TaskNotFoundException.class, call2);
assertThat(e2.getTaskId()).isEqualTo(task2.getId());
}
@ -245,10 +245,10 @@ class DeleteTaskAccTest {
Task notDeletedTask = taskService.getTask(taskNotComplete.getId());
assertThat(notDeletedTask).isNotNull();
ThrowingCallable call = () -> taskService.getTask(task1.getId());
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo(task1.getId());
ThrowingCallable call2 = () -> taskService.getTask(task2.getId());
TaskNotFoundException e2 = catchThrowableOfType(call2, TaskNotFoundException.class);
TaskNotFoundException e2 = catchThrowableOfType(TaskNotFoundException.class, call2);
assertThat(e2.getTaskId()).isEqualTo(task2.getId());
}

View File

@ -224,7 +224,7 @@ class GetTaskAccTest {
ThrowingCallable call = () -> taskService.getTask(task2.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getRequiredPermissions())
.containsExactlyInAnyOrder(WorkbasketPermission.READ, WorkbasketPermission.READTASKS);
@ -238,7 +238,7 @@ class GetTaskAccTest {
ThrowingCallable call = () -> taskService.getTask(task3.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getRequiredPermissions())
.containsExactlyInAnyOrder(WorkbasketPermission.READ, WorkbasketPermission.READTASKS);
@ -251,7 +251,7 @@ class GetTaskAccTest {
void should_ThrowException_When_RequestedTaskByIdIsNotExisting() {
ThrowingCallable call = () -> taskService.getTask("INVALID");
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo("INVALID");
}
@ -269,7 +269,7 @@ class GetTaskAccTest {
ThrowingCallable getTaskCall = () -> taskService.getTask(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(getTaskCall, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, getTaskCall);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getRequiredPermissions()).contains(WorkbasketPermission.READ);
@ -281,7 +281,7 @@ class GetTaskAccTest {
ThrowingCallable call = () -> taskService.getTask(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-taskrouter");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getRequiredPermissions()).contains(WorkbasketPermission.READ);

View File

@ -113,7 +113,7 @@ class RequestChangesAccTest {
ThrowingCallable call = () -> taskService.requestChanges(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getTaskId()).isEqualTo(task.getId());
}
@ -128,7 +128,7 @@ class RequestChangesAccTest {
Task task = createDefaultTask().state(state).buildAndStore(taskService);
ThrowingCallable call = () -> taskService.requestChanges(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getRequiredTaskStates()).containsExactly(TaskState.IN_REVIEW);
assertThat(e.getTaskState()).isEqualTo(state);
assertThat(e.getTaskId()).isEqualTo(task.getId());
@ -143,7 +143,7 @@ class RequestChangesAccTest {
ThrowingCallable call = () -> taskService.requestChanges(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getRequiredPermissions())
.containsExactly(WorkbasketPermission.READ, WorkbasketPermission.READTASKS);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
@ -162,7 +162,7 @@ class RequestChangesAccTest {
Task task = createDefaultTask().state(state).buildAndStore(taskService);
ThrowingCallable call = () -> taskService.forceRequestChanges(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getRequiredTaskStates())
.containsExactlyInAnyOrder(EnumUtil.allValuesExceptFor(TaskState.END_STATES));
assertThat(e.getTaskState()).isEqualTo(state);

View File

@ -214,7 +214,7 @@ public class RequestChangesWithBeforeSpiAccTest {
ThrowingCallable call = () -> taskService.requestChanges(task.getId());
InvalidOwnerException ex = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException ex = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(ex.getTaskId()).isEqualTo(task.getId());
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
}

View File

@ -140,7 +140,7 @@ class RequestReviewAccTest {
ThrowingCallable call = () -> taskService.requestReview(task.getId());
InvalidOwnerException e = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException e = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(e.getTaskId()).isEqualTo(task.getId());
}
@ -156,7 +156,7 @@ class RequestReviewAccTest {
Task task = createDefaultTask().state(state).buildAndStore(taskService);
ThrowingCallable call = () -> taskService.requestReview(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getRequiredTaskStates())
.containsExactlyInAnyOrder(TaskState.CLAIMED, TaskState.IN_REVIEW);
assertThat(e.getTaskState()).isEqualTo(state);
@ -172,7 +172,7 @@ class RequestReviewAccTest {
ThrowingCallable call = () -> taskService.requestReview(task.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getRequiredPermissions())
.containsExactly(WorkbasketPermission.READ, WorkbasketPermission.READTASKS);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
@ -191,7 +191,7 @@ class RequestReviewAccTest {
Task task = createDefaultTask().state(state).buildAndStore(taskService);
ThrowingCallable call = () -> taskService.forceRequestReview(task.getId());
InvalidTaskStateException e = catchThrowableOfType(call, InvalidTaskStateException.class);
InvalidTaskStateException e = catchThrowableOfType(InvalidTaskStateException.class, call);
assertThat(e.getRequiredTaskStates())
.containsExactlyInAnyOrder(EnumUtil.allValuesExceptFor(TaskState.END_STATES));
assertThat(e.getTaskState()).isEqualTo(state);

View File

@ -215,7 +215,7 @@ public class RequestReviewWithBeforeSpiAccTest {
ThrowingCallable call = () -> taskService.requestReview(task.getId());
InvalidOwnerException ex = catchThrowableOfType(call, InvalidOwnerException.class);
InvalidOwnerException ex = catchThrowableOfType(InvalidOwnerException.class, call);
assertThat(ex.getTaskId()).isEqualTo(task.getId());
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
}

View File

@ -283,7 +283,7 @@ public class UpdateTaskAccTest {
ThrowingCallable call = () -> taskService.updateTask(task);
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-taskrouter");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getRequiredPermissions())
@ -403,7 +403,7 @@ public class UpdateTaskAccTest {
ThrowingCallable call = () -> taskService.setTaskRead("INVALID", true);
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo("INVALID");
}
@ -695,7 +695,7 @@ public class UpdateTaskAccTest {
ThrowingCallable call = () -> taskService.updateTask(task);
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
if (t.getRight() != WorkbasketPermission.EDITTASKS) {
assertThat(e.getRequiredPermissions())

View File

@ -102,7 +102,7 @@ class CreateTaskCommentAccTest {
ThrowingCallable call = () -> taskService.createTaskComment(taskCommentToCreate);
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasket.getId());
assertThat(e.getRequiredPermissions())
@ -132,11 +132,11 @@ class CreateTaskCommentAccTest {
newTaskCommentForTaskIdNull.setTextField("a newly created taskComment");
ThrowingCallable call = () -> taskService.createTaskComment(newTaskCommentForNonExistingTask);
TaskNotFoundException e = catchThrowableOfType(call, TaskNotFoundException.class);
TaskNotFoundException e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isEqualTo("Definitely non existing ID");
call = () -> taskService.createTaskComment(newTaskCommentForTaskIdNull);
e = catchThrowableOfType(call, TaskNotFoundException.class);
e = catchThrowableOfType(TaskNotFoundException.class, call);
assertThat(e.getTaskId()).isNull();
}
}

View File

@ -98,7 +98,7 @@ class DeleteTaskCommentAccTest {
.buildAndStore(taskService, "user-1-1");
ThrowingCallable call = () -> taskService.deleteTaskComment(comment1.getId());
NotAuthorizedOnTaskCommentException e =
catchThrowableOfType(call, NotAuthorizedOnTaskCommentException.class);
catchThrowableOfType(NotAuthorizedOnTaskCommentException.class, call);
assertThat(e.getTaskCommentId()).isEqualTo(comment1.getId());
assertThat(e.getCurrentUserId()).isEqualTo(taskanaEngine.getCurrentUserContext().getUserid());
@ -168,7 +168,7 @@ class DeleteTaskCommentAccTest {
void should_FailToDeleteTaskComment_When_CommentIdDoesNotExist() throws Exception {
ThrowingCallable call = () -> taskService.deleteTaskComment("non existing task comment id");
TaskCommentNotFoundException e = catchThrowableOfType(call, TaskCommentNotFoundException.class);
TaskCommentNotFoundException e = catchThrowableOfType(TaskCommentNotFoundException.class, call);
assertThat(e.getTaskCommentId()).isEqualTo("non existing task comment id");
}
}

View File

@ -132,7 +132,7 @@ class GetTaskCommentAccTest {
void should_FailToReturnTaskComments_When_TaskIsNotVisible() {
ThrowingCallable call = () -> taskService.getTaskComments(task1.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getRequiredPermissions())
@ -153,7 +153,7 @@ class GetTaskCommentAccTest {
ThrowingCallable call = () -> taskService.getTaskComment(comment.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getCurrentUserId()).isEqualTo("user-1-2");
assertThat(e.getRequiredPermissions())
@ -183,7 +183,7 @@ class GetTaskCommentAccTest {
String nonExistingId = "Definately Non Existing Task Comment Id";
ThrowingCallable call = () -> taskService.getTaskComment(nonExistingId);
TaskCommentNotFoundException e = catchThrowableOfType(call, TaskCommentNotFoundException.class);
TaskCommentNotFoundException e = catchThrowableOfType(TaskCommentNotFoundException.class, call);
assertThat(e.getTaskCommentId()).isEqualTo(nonExistingId);
}

View File

@ -205,54 +205,50 @@ class UserServiceAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_DetermineDomains_When_WorkbasketPermissionsExistForUsersWithPermissions()
throws Exception {
throws Exception {
Workbasket workbasketDomainA =
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(
"permissions-domaina",
workbasketDomainA,
WorkbasketPermission.READ,
WorkbasketPermission.OPEN);
"permissions-domaina",
workbasketDomainA,
WorkbasketPermission.READ,
WorkbasketPermission.OPEN);
Workbasket workbasketDomainB =
defaultTestWorkbasket()
.domain("DOMAIN_B")
.buildAndStore(workbasketService, "businessadmin");
defaultTestWorkbasket()
.domain("DOMAIN_B")
.buildAndStore(workbasketService, "businessadmin");
createAccessItem(
"permissions-domainb",
workbasketDomainB,
WorkbasketPermission.READ,
WorkbasketPermission.OPEN);
"permissions-domainb",
workbasketDomainB,
WorkbasketPermission.READ,
WorkbasketPermission.OPEN);
Set<User> users = new HashSet<>();
for (int i = 0; i < 6; i++) {
users.add(
randomTestUser()
.permissions(Set.of("test1", "test2", "permissions-domaina"))
.buildAndStore(userService, "businessadmin"));
randomTestUser()
.permissions(Set.of("test1", "test2", "permissions-domaina"))
.buildAndStore(userService, "businessadmin"));
}
for (int i = 0; i < 4; i++) {
users.add(
randomTestUser()
.permissions(Set.of("test1", "test2", "permissions-domainb"))
.buildAndStore(userService, "businessadmin"));
randomTestUser()
.permissions(Set.of("test1", "test2", "permissions-domainb"))
.buildAndStore(userService, "businessadmin"));
}
Set<String> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
List<User> returnedUsers = userService.getUsers(userIds);
assertThat(returnedUsers)
.extracting(User::getDomains)
.areExactly(
6,
new Condition<>(
domains ->
Set.of(workbasketDomainA.getDomain())
.equals(domains), "DOMAIN_A"))
.areExactly(
4,
new Condition<>(
domains ->
Set.of(workbasketDomainB.getDomain())
.equals(domains), "DOMAIN_B"));
.extracting(User::getDomains)
.areExactly(
6,
new Condition<>(
domains -> Set.of(workbasketDomainA.getDomain()).equals(domains), "DOMAIN_A"))
.areExactly(
4,
new Condition<>(
domains -> Set.of(workbasketDomainB.getDomain()).equals(domains), "DOMAIN_B"));
}
@WithAccessId(user = "user-1-1")
@ -536,7 +532,7 @@ class UserServiceAccTest {
userToCreate.setLastName("lastName");
ThrowingCallable callable = () -> userService.createUser(userToCreate);
NotAuthorizedException ex = catchThrowableOfType(callable, NotAuthorizedException.class);
NotAuthorizedException ex = catchThrowableOfType(NotAuthorizedException.class, callable);
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(ex.getRoles())
.isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN});
@ -634,9 +630,8 @@ class UserServiceAccTest {
t -> {
Set<String> existingPerms = t.getMiddle();
Set<String> newPerms = t.getMiddle();
User userToUpdate = randomTestUser()
.permissions(existingPerms)
.buildAndStore(userService);
User userToUpdate =
randomTestUser().permissions(existingPerms).buildAndStore(userService);
userToUpdate.setPermissions(newPerms);
userService.updateUser(userToUpdate);
@ -661,7 +656,7 @@ class UserServiceAccTest {
userService.updateUser(userToUpdate);
};
NotAuthorizedException ex = catchThrowableOfType(callable, NotAuthorizedException.class);
NotAuthorizedException ex = catchThrowableOfType(NotAuthorizedException.class, callable);
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(ex.getRoles())
.isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN});
@ -944,8 +939,8 @@ class UserServiceAccTest {
void should_DeletePermissionsFromDatabase_When_UserHadPermissions() throws Exception {
User userToDelete =
randomTestUser()
.permissions(Set.of("permission1", "permission2"))
.buildAndStore(userService);
.permissions(Set.of("permission1", "permission2"))
.buildAndStore(userService);
userService.deleteUser(userToDelete.getId());
@ -975,7 +970,7 @@ class UserServiceAccTest {
ThrowingCallable callable = () -> userService.deleteUser(userToDelete.getId());
NotAuthorizedException ex = catchThrowableOfType(callable, NotAuthorizedException.class);
NotAuthorizedException ex = catchThrowableOfType(NotAuthorizedException.class, callable);
assertThat(ex.getCurrentUserId()).isEqualTo("user-1-1");
assertThat(ex.getRoles())
.isEqualTo(new TaskanaRole[] {TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN});
@ -1045,16 +1040,16 @@ class UserServiceAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_ReturnOneDomain_When_PermissionHasSufficientMinimalPermissionsToAssignDomains()
throws Exception {
throws Exception {
String permissionsId = UUID.randomUUID().toString();
User user =
randomTestUser()
.permissions(Set.of(permissionsId))
.buildAndStore(userService, "businessadmin");
randomTestUser()
.permissions(Set.of(permissionsId))
.buildAndStore(userService, "businessadmin");
Workbasket workbasket =
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(permissionsId,
workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(
permissionsId, workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
User userInDatabase = userService.getUser(user.getId());
@ -1112,7 +1107,7 @@ class UserServiceAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ReturnEmptyDomains_When_GroupHasSufficientPermissionsAndThenPermissionIsUpdated()
throws Exception {
throws Exception {
String groupId = UUID.randomUUID().toString();
User user = randomTestUser().permissions(Set.of(groupId)).buildAndStore(userService);
Workbasket workbasket = defaultTestWorkbasket().buildAndStore(workbasketService);
@ -1181,27 +1176,27 @@ class UserServiceAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_ReturnMultipleDomains_When_UserAndPermHaveSufficientMinimalPermsForMultipleDomains()
throws Exception {
throws Exception {
String permissionId = UUID.randomUUID().toString();
User user =
randomTestUser()
.permissions(Set.of(permissionId))
.buildAndStore(userService, "businessadmin");
randomTestUser()
.permissions(Set.of(permissionId))
.buildAndStore(userService, "businessadmin");
Workbasket workbasket1 =
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
Workbasket workbasket2 =
defaultTestWorkbasket()
.domain("DOMAIN_B")
.buildAndStore(workbasketService, "businessadmin");
defaultTestWorkbasket()
.domain("DOMAIN_B")
.buildAndStore(workbasketService, "businessadmin");
createAccessItem(
user.getId(), workbasket1, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
user.getId(), workbasket1, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
createAccessItem(
permissionId, workbasket2, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
permissionId, workbasket2, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
User userInDatabase = userService.getUser(user.getId());
assertThat(userInDatabase.getDomains())
.containsExactlyInAnyOrder(workbasket1.getDomain(), workbasket2.getDomain());
.containsExactlyInAnyOrder(workbasket1.getDomain(), workbasket2.getDomain());
}
@Nested
@ -1250,18 +1245,16 @@ class UserServiceAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_ReturnEmptyDomains_When_PermHasInsufficientMinimalPermissionsToAssignDomains()
throws Exception {
throws Exception {
String permissionId = UUID.randomUUID().toString();
User user =
randomTestUser()
.permissions(Set.of(permissionId))
.buildAndStore(userService, "businessadmin");
randomTestUser()
.permissions(Set.of(permissionId))
.buildAndStore(userService, "businessadmin");
Workbasket workbasket =
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(permissionId,
workbasket,
WorkbasketPermission.OPEN,
WorkbasketPermission.READ);
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(
permissionId, workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
User userInDatabase = userService.getUser(user.getId());
@ -1299,7 +1292,6 @@ class UserServiceAccTest {
assertThat(userInDatabase.getDomains()).containsExactly(workbasket.getDomain());
}
}
@Nested
@ -1346,19 +1338,16 @@ class UserServiceAccTest {
@WithAccessId(user = "user-1-1")
@Test
void should_ReturnEmptyDomains_When_PropertyIsNotSetAndPermission()
throws Exception {
void should_ReturnEmptyDomains_When_PropertyIsNotSetAndPermission() throws Exception {
String permissionId = UUID.randomUUID().toString();
User user =
randomTestUser()
.permissions(Set.of(permissionId))
.buildAndStore(userService, "businessadmin");
randomTestUser()
.permissions(Set.of(permissionId))
.buildAndStore(userService, "businessadmin");
Workbasket workbasket =
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(permissionId,
workbasket,
WorkbasketPermission.OPEN,
WorkbasketPermission.READ);
defaultTestWorkbasket().buildAndStore(workbasketService, "businessadmin");
createAccessItem(
permissionId, workbasket, WorkbasketPermission.OPEN, WorkbasketPermission.READ);
User userInDatabase = userService.getUser(user.getId());

View File

@ -141,7 +141,7 @@ class GetWorkbasketAccTest {
void should_ThrowException_When_ProvidingAnInvalidId() {
ThrowingCallable call = () -> workbasketService.getWorkbasket("INVALID_ID");
WorkbasketNotFoundException e = catchThrowableOfType(call, WorkbasketNotFoundException.class);
WorkbasketNotFoundException e = catchThrowableOfType(WorkbasketNotFoundException.class, call);
assertThat(e.getId()).isEqualTo("INVALID_ID");
}
@ -159,7 +159,7 @@ class GetWorkbasketAccTest {
() -> workbasketService.getWorkbasket(t.getMiddle(), t.getRight());
WorkbasketNotFoundException e =
catchThrowableOfType(call, WorkbasketNotFoundException.class);
catchThrowableOfType(WorkbasketNotFoundException.class, call);
assertThat(e.getKey()).isEqualTo(t.getMiddle());
assertThat(e.getDomain()).isEqualTo(t.getRight());
@ -172,7 +172,7 @@ class GetWorkbasketAccTest {
ThrowingCallable call = () -> workbasketService.getWorkbasket(defaultWorkbasketSummary.getId());
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getWorkbasketId()).isEqualTo(defaultWorkbasketSummary.getId());
assertThat(e.getCurrentUserId()).isNull();
@ -184,7 +184,7 @@ class GetWorkbasketAccTest {
ThrowingCallable call = () -> workbasketService.getWorkbasket("USER-1-2", "DOMAIN_A");
NotAuthorizedOnWorkbasketException e =
catchThrowableOfType(call, NotAuthorizedOnWorkbasketException.class);
catchThrowableOfType(NotAuthorizedOnWorkbasketException.class, call);
assertThat(e.getWorkbasketKey()).isEqualTo("USER-1-2");
assertThat(e.getDomain()).isEqualTo("DOMAIN_A");
@ -197,7 +197,7 @@ class GetWorkbasketAccTest {
void should_ThrowException_When_TryingToGetWithAnInvalidId() {
ThrowingCallable call = () -> workbasketService.getWorkbasket("NOT EXISTING ID");
WorkbasketNotFoundException e = catchThrowableOfType(call, WorkbasketNotFoundException.class);
WorkbasketNotFoundException e = catchThrowableOfType(WorkbasketNotFoundException.class, call);
assertThat(e.getId()).isEqualTo("NOT EXISTING ID");
}

View File

@ -82,9 +82,9 @@
<version.arquillian.managed.wildfly>5.0.1.Final</version.arquillian.managed.wildfly>
<!-- test dependencies -->
<version.assertj>3.25.3</version.assertj>
<version.archunit>1.3.0</version.archunit>
<version.equalsverifier>3.16.1</version.equalsverifier>
<version.assertj>3.26.3</version.assertj>
<version.openpojo>0.9.1</version.openpojo>
<version.jacoco>0.8.12</version.jacoco>
<version.slf4j-test>3.0.1</version.slf4j-test>
@ -120,9 +120,7 @@
<sonar.sources>src/main/java</sonar.sources>
<sonar.tests>src/test/java</sonar.tests>
<sonar.exclusions>
org/camunda/bpm/dmn/**/*,
**/example/**/*,
**/*Example*
org/camunda/bpm/dmn/**/*, **/example/**/*, **/*Example*
</sonar.exclusions>
</properties>