TSK-1716: Replaced immutable Collections with mutable ones in all our entities.

This commit is contained in:
Martin Sawilla 2021-08-24 18:28:08 +02:00 committed by Mustapha Zorgati
parent e564778a91
commit 38fbc66f7f
2 changed files with 7 additions and 10 deletions

View File

@ -1,7 +1,6 @@
package pro.taskana.task.internal.models;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -21,8 +20,8 @@ import pro.taskana.workbasket.internal.models.WorkbasketSummaryImpl;
public class TaskImpl extends TaskSummaryImpl implements Task {
// All objects have to be serializable
private Map<String, String> customAttributes = Collections.emptyMap();
private Map<String, String> callbackInfo = Collections.emptyMap();
private Map<String, String> customAttributes = new HashMap<>();
private Map<String, String> callbackInfo = new HashMap<>();
private CallbackState callbackState;
private List<Attachment> attachments = new ArrayList<>();

View File

@ -1,6 +1,7 @@
package acceptance.task;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import acceptance.AbstractAccTest;
@ -77,6 +78,8 @@ class GetTaskAccTest extends AbstractAccTest {
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_14)).isEqualTo("abc");
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_15)).isEqualTo("custom15");
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_16)).isEqualTo("custom16");
assertThatCode(() -> task.getCustomAttributeMap().put("X", "Y")).doesNotThrowAnyException();
assertThatCode(() -> task.getCallbackInfo().put("X", "Y")).doesNotThrowAnyException();
}
@WithAccessId(user = "user-1-1")
@ -84,10 +87,7 @@ class GetTaskAccTest extends AbstractAccTest {
void should_ThrowException_When_RequestedTaskByIdIsNotExisting() {
TaskService taskService = taskanaEngine.getTaskService();
ThrowingCallable call =
() -> {
taskService.getTask("INVALID");
};
ThrowingCallable call = () -> taskService.getTask("INVALID");
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
}
@ -98,9 +98,7 @@ class GetTaskAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
ThrowingCallable getTaskCall =
() -> {
taskService.getTask("TKI:000000000000000000000000000000000000");
};
() -> taskService.getTask("TKI:000000000000000000000000000000000000");
assertThatThrownBy(getTaskCall).isInstanceOf(NotAuthorizedException.class);
}