TSK-1716: Replaced immutable Collections with mutable ones in all our entities.
This commit is contained in:
parent
e564778a91
commit
38fbc66f7f
|
|
@ -1,7 +1,6 @@
|
||||||
package pro.taskana.task.internal.models;
|
package pro.taskana.task.internal.models;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -21,8 +20,8 @@ import pro.taskana.workbasket.internal.models.WorkbasketSummaryImpl;
|
||||||
public class TaskImpl extends TaskSummaryImpl implements Task {
|
public class TaskImpl extends TaskSummaryImpl implements Task {
|
||||||
|
|
||||||
// All objects have to be serializable
|
// All objects have to be serializable
|
||||||
private Map<String, String> customAttributes = Collections.emptyMap();
|
private Map<String, String> customAttributes = new HashMap<>();
|
||||||
private Map<String, String> callbackInfo = Collections.emptyMap();
|
private Map<String, String> callbackInfo = new HashMap<>();
|
||||||
private CallbackState callbackState;
|
private CallbackState callbackState;
|
||||||
private List<Attachment> attachments = new ArrayList<>();
|
private List<Attachment> attachments = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package acceptance.task;
|
package acceptance.task;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
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 static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
|
|
@ -77,6 +78,8 @@ class GetTaskAccTest extends AbstractAccTest {
|
||||||
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_14)).isEqualTo("abc");
|
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_14)).isEqualTo("abc");
|
||||||
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_15)).isEqualTo("custom15");
|
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_15)).isEqualTo("custom15");
|
||||||
assertThat(task.getCustomAttribute(TaskCustomField.CUSTOM_16)).isEqualTo("custom16");
|
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")
|
@WithAccessId(user = "user-1-1")
|
||||||
|
|
@ -84,10 +87,7 @@ class GetTaskAccTest extends AbstractAccTest {
|
||||||
void should_ThrowException_When_RequestedTaskByIdIsNotExisting() {
|
void should_ThrowException_When_RequestedTaskByIdIsNotExisting() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
ThrowingCallable call =
|
ThrowingCallable call = () -> taskService.getTask("INVALID");
|
||||||
() -> {
|
|
||||||
taskService.getTask("INVALID");
|
|
||||||
};
|
|
||||||
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
|
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,9 +98,7 @@ class GetTaskAccTest extends AbstractAccTest {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
ThrowingCallable getTaskCall =
|
ThrowingCallable getTaskCall =
|
||||||
() -> {
|
() -> taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
taskService.getTask("TKI:000000000000000000000000000000000000");
|
|
||||||
};
|
|
||||||
assertThatThrownBy(getTaskCall).isInstanceOf(NotAuthorizedException.class);
|
assertThatThrownBy(getTaskCall).isInstanceOf(NotAuthorizedException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue