From 0eb877705be4e84bf5ddac4b84dc4a03871f30e6 Mon Sep 17 00:00:00 2001 From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Date: Fri, 30 Oct 2020 11:07:09 +0100 Subject: [PATCH] TSK-1282: replaced Collections.singletonList with List.of in all tests --- .../UpdateClassificationAccTest.java | 14 ++- ...CustomAttributeValuesForReportAccTest.java | 8 +- ...OfClassificationCategoryReportAccTest.java | 18 ++-- ...tTaskIdsOfClassificationReportAccTest.java | 3 +- ...dsOfTaskCustomFieldValueReportAccTest.java | 15 ++-- .../GetTaskIdsOfWorkbasketReportAccTest.java | 8 +- ...deClassificationCategoryReportAccTest.java | 13 ++- .../ProvideClassificationReportAccTest.java | 13 ++- ...deDetailedClassificationReportAccTest.java | 13 ++- ...videTaskCustomFieldValueReportAccTest.java | 10 +-- .../ProvideTaskStatusReportAccTest.java | 10 +-- .../report/ProvideTimestampReportAccTest.java | 12 +-- .../ProvideWorkbasketReportAccTest.java | 17 ++-- .../acceptance/task/CompleteTaskAccTest.java | 13 ++- .../task/ServiceLevelPriorityAccTest.java | 3 +- .../java/acceptance/task/SetOwnerAccTest.java | 3 +- .../acceptance/task/TransferTaskAccTest.java | 3 +- .../DistributionTargetsAccTest.java | 6 +- ...ficationCategoryReportBuilderImplTest.java | 63 ++++++------- .../ClassificationReportBuilderImplTest.java | 89 +++++++++---------- ...CustomFieldValueReportBuilderImplTest.java | 40 ++++----- .../WorkbasketReportBuilderImplTest.java | 79 ++++++++-------- ...orkbasketServiceImplIntAutocommitTest.java | 3 +- .../WorkbasketServiceImplIntExplicitTest.java | 3 +- .../internal/WorkbasketServiceImplTest.java | 3 +- ...sificationDefinitionControllerIntTest.java | 20 ++--- .../taskana/common/rest/QueryHelperTest.java | 23 +++-- .../common/rest/ldap/LdapClientTest.java | 5 +- .../TaskRepresentationModelAssemberTest.java | 12 ++- ...mmaryRepresentationModelAssemblerTest.java | 5 +- 30 files changed, 222 insertions(+), 305 deletions(-) diff --git a/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java b/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java index eada155b2..5d6b11109 100644 --- a/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/classification/UpdateClassificationAccTest.java @@ -9,7 +9,6 @@ import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.junit.jupiter.api.Test; @@ -200,12 +199,12 @@ class UpdateClassificationAccTest extends AbstractAccTest { before, tasksWithP1D, taskService, converter, 1, 1000); List tasksWithP8D = - new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000008")); + new ArrayList<>(List.of("TKI:000000000000000000000000000000000008")); validateTaskPropertiesAfterClassificationChange( before, tasksWithP8D, taskService, converter, 8, 1000); List tasksWithP14D = - new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000010")); + new ArrayList<>(List.of("TKI:000000000000000000000000000000000010")); validateTaskPropertiesAfterClassificationChange( before, tasksWithP14D, taskService, converter, 14, 1000); @@ -343,7 +342,7 @@ class UpdateClassificationAccTest extends AbstractAccTest { before, tasksWithPrio99, taskService, converter, 1, 99); List tasksWithPrio101 = - new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000011")); + new ArrayList<>(List.of("TKI:000000000000000000000000000000000011")); validateTaskPropertiesAfterClassificationChange( before, tasksWithPrio101, taskService, converter, 1, 101); @@ -398,12 +397,11 @@ class UpdateClassificationAccTest extends AbstractAccTest { before, tasksWithPrio7, taskService, converter, 1, 7); List tasksWithPrio9 = - new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000008")); + new ArrayList<>(List.of("TKI:000000000000000000000000000000000008")); validateTaskPropertiesAfterClassificationChange( before, tasksWithPrio9, taskService, converter, 1, 9); - tasksWithPrio101 = - new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000011")); + tasksWithPrio101 = new ArrayList<>(List.of("TKI:000000000000000000000000000000000011")); validateTaskPropertiesAfterClassificationChange( before, tasksWithPrio101, taskService, converter, 1, 101); @@ -471,7 +469,7 @@ class UpdateClassificationAccTest extends AbstractAccTest { before, tasksWithPD12, taskService, converter, 12, 555); List tasksWithPD8 = - new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000008")); + new ArrayList<>(List.of("TKI:000000000000000000000000000000000008")); validateTaskPropertiesAfterClassificationChange( before, tasksWithPD8, taskService, converter, 8, 555); diff --git a/lib/taskana-core/src/test/java/acceptance/report/GetCustomAttributeValuesForReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/GetCustomAttributeValuesForReportAccTest.java index 59e1575d4..d57f2e51d 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/GetCustomAttributeValuesForReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/GetCustomAttributeValuesForReportAccTest.java @@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,7 +39,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest { List values = MONITOR_SERVICE .createWorkbasketReportBuilder() - .workbasketIdIn(Collections.singletonList("WBI:000000000000000000000000000000000001")) + .workbasketIdIn(List.of("WBI:000000000000000000000000000000000001")) .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_2); assertThat(values).containsExactlyInAnyOrder("Vollkasko", "Teilkasko"); @@ -52,7 +51,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest { List values = MONITOR_SERVICE .createWorkbasketReportBuilder() - .domainIn(Collections.singletonList("DOMAIN_A")) + .domainIn(List.of("DOMAIN_A")) .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_16); assertThat(values).hasSize(26); } @@ -82,8 +81,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createClassificationCategoryReportBuilder() .domainIn(domains) - .excludedClassificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000003")) + .excludedClassificationIdIn(List.of("CLI:000000000000000000000000000000000003")) .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_16); assertThat(values).hasSize(43); diff --git a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationCategoryReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationCategoryReportAccTest.java index 1947bab31..53fe98961 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationCategoryReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationCategoryReportAccTest.java @@ -62,7 +62,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT () -> MONITOR_SERVICE .createClassificationCategoryReportBuilder() - .listTaskIdsForSelectedItems(Collections.singletonList(EXTERN), timestamp); + .listTaskIdsForSelectedItems(List.of(EXTERN), timestamp); assertThatCode(callable).doesNotThrowAnyException(); }; @@ -72,11 +72,9 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT @WithAccessId(user = "monitor") @Test void should_SelectCompletedItems_When_CompletedTimeStampIsRequested() throws Exception { - final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0)); + final List columnHeaders = List.of(new TimeIntervalColumnHeader(0)); - final List selectedItems = - Collections.singletonList(new SelectedItem("EXTERN", null, 0, 0)); + final List selectedItems = List.of(new SelectedItem("EXTERN", null, 0, 0)); List ids = MONITOR_SERVICE @@ -122,8 +120,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT @WithAccessId(user = "monitor") @Test void testGetTaskIdsOfCategoryReportWithWorkbasketFilter() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List columnHeaders = getListOfColumnHeaders(); final List selectedItems = Arrays.asList(EXTERN, AUTOMATIC, MANUAL); @@ -147,7 +144,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT @WithAccessId(user = "monitor") @Test void testGetTaskIdsOfCategoryReportWithStateFilter() throws Exception { - final List states = Collections.singletonList(TaskState.READY); + final List states = List.of(TaskState.READY); final List columnHeaders = getListOfColumnHeaders(); final List selectedItems = Arrays.asList(EXTERN, AUTOMATIC, MANUAL); @@ -201,7 +198,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT @WithAccessId(user = "monitor") @Test void testGetTaskIdsOfCategoryReportWithDomainFilter() throws Exception { - final List domains = Collections.singletonList("DOMAIN_A"); + final List domains = List.of("DOMAIN_A"); final List columnHeaders = getListOfColumnHeaders(); final List selectedItems = Arrays.asList(EXTERN, AUTOMATIC, MANUAL); @@ -253,8 +250,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT void testThrowsExceptionIfSubKeysAreUsed() { final List columnHeaders = getListOfColumnHeaders(); - final List selectedItems = - Collections.singletonList(new SelectedItem("EXTERN", "INVALID", -5, -2)); + final List selectedItems = List.of(new SelectedItem("EXTERN", "INVALID", -5, -2)); ThrowingCallable call = () -> diff --git a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationReportAccTest.java index 99c317988..078c6a498 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfClassificationReportAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.stream.Stream; @@ -60,7 +59,7 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest { () -> MONITOR_SERVICE .createClassificationReportBuilder() - .listTaskIdsForSelectedItems(Collections.singletonList(L_10000), timestamp); + .listTaskIdsForSelectedItems(List.of(L_10000), timestamp); assertThatCode(callable).doesNotThrowAnyException(); }; diff --git a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfTaskCustomFieldValueReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfTaskCustomFieldValueReportAccTest.java index 1dccb0a04..f2ed4a29f 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfTaskCustomFieldValueReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfTaskCustomFieldValueReportAccTest.java @@ -64,8 +64,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes () -> MONITOR_SERVICE .createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1) - .listTaskIdsForSelectedItems( - Collections.singletonList(GESCHAEFTSSTELLE_A), timestamp); + .listTaskIdsForSelectedItems(List.of(GESCHAEFTSSTELLE_A), timestamp); assertThatCode(callable).doesNotThrowAnyException(); }; @@ -77,8 +76,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes void should_SelectCompletedItems_When_CompletedTimeStampIsRequested() throws Exception { List columnHeaders = getListOfColumnHeaders(); List selectedItems = - Collections.singletonList( - new SelectedItem("Geschaeftsstelle A", null, Integer.MIN_VALUE, -5)); + List.of(new SelectedItem("Geschaeftsstelle A", null, Integer.MIN_VALUE, -5)); List ids = MONITOR_SERVICE @@ -119,8 +117,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes @WithAccessId(user = "monitor") @Test void testGetTaskIdsOfCustomFieldValueReportWithWorkbasketFilter() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List columnHeaders = getListOfColumnHeaders(); List selectedItems = Arrays.asList(GESCHAEFTSSTELLE_A, GESCHAEFTSSTELLE_B, GESCHAEFTSSTELLE_C); @@ -152,7 +149,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes .createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1) .withColumnHeaders(columnHeaders) .inWorkingDays() - .stateIn(Collections.singletonList(TaskState.READY)) + .stateIn(List.of(TaskState.READY)) .listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE); assertThat(ids).hasSize(8); @@ -200,7 +197,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes .createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1) .withColumnHeaders(columnHeaders) .inWorkingDays() - .domainIn(Collections.singletonList("DOMAIN_A")) + .domainIn(List.of("DOMAIN_A")) .listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE); assertThat(ids).hasSize(3); @@ -238,7 +235,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes void testThrowsExceptionIfSubKeysAreUsed() { final List columnHeaders = getListOfColumnHeaders(); final List selectedItems = - Collections.singletonList(new SelectedItem("Geschaeftsstelle A", "INVALID", -5, -2)); + List.of(new SelectedItem("Geschaeftsstelle A", "INVALID", -5, -2)); ThrowingCallable call = () -> diff --git a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfWorkbasketReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfWorkbasketReportAccTest.java index 75f27e2c3..b4ebd0219 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfWorkbasketReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/GetTaskIdsOfWorkbasketReportAccTest.java @@ -59,7 +59,7 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest { () -> MONITOR_SERVICE .createWorkbasketReportBuilder() - .listTaskIdsForSelectedItems(Collections.singletonList(S_1), timestamp); + .listTaskIdsForSelectedItems(List.of(S_1), timestamp); assertThatCode(callable).doesNotThrowAnyException(); }; @@ -117,8 +117,7 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest { .createWorkbasketReportBuilder() .withColumnHeaders(columnHeaders) .inWorkingDays() - .excludedClassificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000001")) + .excludedClassificationIdIn(List.of("CLI:000000000000000000000000000000000001")) .listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE); assertThat(ids) @@ -135,8 +134,7 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest { throws Exception { final List columnHeaders = getListOfColumnHeaders(); final List selectedItems = - Collections.singletonList( - new SelectedItem("USER-1-1", null, Integer.MIN_VALUE, Integer.MAX_VALUE)); + List.of(new SelectedItem("USER-1-1", null, Integer.MIN_VALUE, Integer.MAX_VALUE)); final List combinedClassificationFilters = Arrays.asList( new CombinedClassificationFilter( diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationCategoryReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationCategoryReportAccTest.java index 4dabbe3c0..de0eaacf6 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationCategoryReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationCategoryReportAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -61,7 +60,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest { Builder builder = MONITOR_SERVICE .createClassificationCategoryReportBuilder() - .classificationIdIn(Collections.singletonList("DOES NOT EXIST")); + .classificationIdIn(List.of("DOES NOT EXIST")); ThrowingCallable test = () -> { ClassificationCategoryReport report = builder.buildReport(); @@ -80,8 +79,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createClassificationCategoryReportBuilder() .withColumnHeaders(columnHeaders) - .classificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000001")) + .classificationIdIn(List.of("CLI:000000000000000000000000000000000001")) .buildReport(); assertThat(report).isNotNull(); @@ -224,8 +222,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfCategoryReportWithWorkbasketFilter() throws Exception { - List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); List columnHeaders = getShortListOfColumnHeaders(); ClassificationCategoryReport report = @@ -252,7 +249,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfCategoryReportWithStateFilter() throws Exception { - List states = Collections.singletonList(TaskState.READY); + List states = List.of(TaskState.READY); List columnHeaders = getShortListOfColumnHeaders(); ClassificationCategoryReport report = @@ -303,7 +300,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfCategoryReportWithDomainFilter() throws Exception { - List domains = Collections.singletonList("DOMAIN_A"); + List domains = List.of("DOMAIN_A"); List columnHeaders = getShortListOfColumnHeaders(); ClassificationCategoryReport report = diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationReportAccTest.java index bb3ff736e..2e6e377bb 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideClassificationReportAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -61,7 +60,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest { Builder builder = MONITOR_SERVICE .createClassificationReportBuilder() - .classificationIdIn(Collections.singletonList("DOES NOT EXIST")); + .classificationIdIn(List.of("DOES NOT EXIST")); ThrowingCallable test = () -> { ClassificationReport report = builder.buildReport(); @@ -80,8 +79,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createClassificationReportBuilder() .withColumnHeaders(columnHeaders) - .classificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000001")) + .classificationIdIn(List.of("CLI:000000000000000000000000000000000001")) .buildReport(); assertThat(report).isNotNull(); @@ -243,8 +241,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfClassificationReportWithWorkbasketFilter() throws Exception { - List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); List columnHeaders = getShortListOfColumnHeaders(); ClassificationReport report = @@ -277,7 +274,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfClassificationReportWithStateFilter() throws Exception { - List states = Collections.singletonList(TaskState.READY); + List states = List.of(TaskState.READY); List columnHeaders = getShortListOfColumnHeaders(); ClassificationReport report = @@ -334,7 +331,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfClassificationReportWithDomainFilter() throws Exception { - List domains = Collections.singletonList("DOMAIN_A"); + List domains = List.of("DOMAIN_A"); List columnHeaders = getShortListOfColumnHeaders(); ClassificationReport report = diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideDetailedClassificationReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideDetailedClassificationReportAccTest.java index b87facf97..10b182961 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideDetailedClassificationReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideDetailedClassificationReportAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -56,8 +55,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createClassificationReportBuilder() .withColumnHeaders(columnHeaders) - .classificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000001")) + .classificationIdIn(List.of("CLI:000000000000000000000000000000000001")) .buildDetailedReport(); assertThat(report).isNotNull(); @@ -114,7 +112,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest { Builder builder = MONITOR_SERVICE .createClassificationReportBuilder() - .classificationIdIn(Collections.singletonList("DOES NOT EXIST")); + .classificationIdIn(List.of("DOES NOT EXIST")); ThrowingCallable test = () -> { DetailedClassificationReport report = builder.buildDetailedReport(); @@ -331,8 +329,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfDetailedClassificationReportWithWorkbasketFilter() throws Exception { - List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); List columnHeaders = getShortListOfColumnHeaders(); DetailedClassificationReport report = @@ -389,7 +386,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfDetailedClassificationReportWithStateFilter() throws Exception { - List states = Collections.singletonList(TaskState.READY); + List states = List.of(TaskState.READY); List columnHeaders = getShortListOfColumnHeaders(); DetailedClassificationReport report = @@ -539,7 +536,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfDetailedClassificationReportWithDomainFilter() throws Exception { - List domains = Collections.singletonList("DOMAIN_A"); + List domains = List.of("DOMAIN_A"); List columnHeaders = getShortListOfColumnHeaders(); DetailedClassificationReport report = diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskCustomFieldValueReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskCustomFieldValueReportAccTest.java index 928fe5096..3875f37e5 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskCustomFieldValueReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskCustomFieldValueReportAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -70,7 +69,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest { Builder builder = MONITOR_SERVICE .createTaskCustomFieldValueReportBuilder(TaskCustomField.CUSTOM_1) - .classificationIdIn(Collections.singletonList("DOES NOT EXIST")); + .classificationIdIn(List.of("DOES NOT EXIST")); ThrowingCallable test = () -> { TaskCustomFieldValueReport report = builder.buildReport(); @@ -239,8 +238,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfCustomFieldValueReportWithWorkbasketFilter() throws Exception { - List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); List columnHeaders = getShortListOfColumnHeaders(); TaskCustomFieldValueReport report = @@ -267,7 +265,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfCustomFieldValueReportWithStateFilter() throws Exception { - List states = Collections.singletonList(TaskState.READY); + List states = List.of(TaskState.READY); List columnHeaders = getShortListOfColumnHeaders(); TaskCustomFieldValueReport report = @@ -321,7 +319,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfCustomFieldValueReportWithDomainFilter() throws Exception { - List domains = Collections.singletonList("DOMAIN_A"); + List domains = List.of("DOMAIN_A"); List columnHeaders = getShortListOfColumnHeaders(); TaskCustomFieldValueReport report = diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskStatusReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskStatusReportAccTest.java index 7aa7fe03e..84b1cc2a8 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskStatusReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideTaskStatusReportAccTest.java @@ -6,7 +6,7 @@ import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Arrays; -import java.util.Collections; +import java.util.List; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -73,9 +73,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest { @Test void should_NotThrowSqlExceptionDuringAugmentation_When_ReportContainsNoRows() { TaskStatusReport.Builder builder = - MONITOR_SERVICE - .createTaskStatusReportBuilder() - .domainIn(Collections.singletonList("DOES NOT EXIST")); + MONITOR_SERVICE.createTaskStatusReportBuilder().domainIn(List.of("DOES NOT EXIST")); ThrowingCallable test = () -> { TaskStatusReport report = builder.buildReport(); @@ -145,7 +143,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest { TaskStatusReport report = MONITOR_SERVICE .createTaskStatusReportBuilder() - .stateIn(Collections.singletonList(TaskState.READY)) + .stateIn(List.of(TaskState.READY)) .buildReport(); assertThat(report).isNotNull(); @@ -200,7 +198,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest { TaskStatusReport report = MONITOR_SERVICE .createTaskStatusReportBuilder() - .workbasketIdsIn(Collections.singletonList("WBI:000000000000000000000000000000000003")) + .workbasketIdsIn(List.of("WBI:000000000000000000000000000000000003")) .buildReport(); assertThat(report).isNotNull(); diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideTimestampReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideTimestampReportAccTest.java index 2dc6caa26..cd2f299dd 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideTimestampReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideTimestampReportAccTest.java @@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; @@ -41,9 +40,7 @@ class ProvideTimestampReportAccTest extends AbstractReportAccTest { @Test void should_NotThrowSqlExceptionDuringAugmentation_When_ReportContainsNoRows() { TimestampReport.Builder builder = - MONITOR_SERVICE - .createTimestampReportBuilder() - .domainIn(Collections.singletonList("DOES_NOT_EXIST")); + MONITOR_SERVICE.createTimestampReportBuilder().domainIn(List.of("DOES_NOT_EXIST")); ThrowingCallable test = () -> { TimestampReport report = builder.buildReport(); @@ -64,7 +61,7 @@ class ProvideTimestampReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createTimestampReportBuilder() .withColumnHeaders(headers) - .domainIn(Collections.singletonList("DOMAIN_A")) + .domainIn(List.of("DOMAIN_A")) .buildReport(); assertThat(report).isNotNull(); @@ -87,8 +84,7 @@ class ProvideTimestampReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createTimestampReportBuilder() .withColumnHeaders(headers) - .classificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000001")) + .classificationIdIn(List.of("CLI:000000000000000000000000000000000001")) .buildReport(); assertThat(report).isNotNull(); @@ -119,7 +115,7 @@ class ProvideTimestampReportAccTest extends AbstractReportAccTest { TimestampReport timestampReport = MONITOR_SERVICE.createTimestampReportBuilder().withColumnHeaders(headers).buildReport(); final HashSet org1Set = new HashSet<>(Arrays.asList("N/A", "org1")); - final HashSet allOtherOrgLevelSet = new HashSet<>(Collections.singletonList("N/A")); + final HashSet allOtherOrgLevelSet = new HashSet<>(List.of("N/A")); assertThat(timestampReport.getRows()).hasSize(2); assertThat(timestampReport.getRows().keySet()) diff --git a/lib/taskana-core/src/test/java/acceptance/report/ProvideWorkbasketReportAccTest.java b/lib/taskana-core/src/test/java/acceptance/report/ProvideWorkbasketReportAccTest.java index e4cad2bce..93e04ed01 100644 --- a/lib/taskana-core/src/test/java/acceptance/report/ProvideWorkbasketReportAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/report/ProvideWorkbasketReportAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -56,9 +55,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { @Test void should_NotThrowSqlExceptionDuringAugmentation_When_ReportContainsNoRows() { WorkbasketReport.Builder builder = - MONITOR_SERVICE - .createWorkbasketReportBuilder() - .domainIn(Collections.singletonList("DOES_NOT_EXIST")); + MONITOR_SERVICE.createWorkbasketReportBuilder().domainIn(List.of("DOES_NOT_EXIST")); ThrowingCallable test = () -> { WorkbasketReport report = builder.buildReport(); @@ -92,8 +89,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { MONITOR_SERVICE .createWorkbasketReportBuilder() .withColumnHeaders(columnHeaders) - .classificationIdIn( - Collections.singletonList("CLI:000000000000000000000000000000000001")) + .classificationIdIn(List.of("CLI:000000000000000000000000000000000001")) .buildReport(); assertThat(report).isNotNull(); assertThat(report.rowSize()).isEqualTo(2); @@ -216,8 +212,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfWorkbasketReportWithWorkbasketFilter() throws Exception { - List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); List columnHeaders = getShortListOfColumnHeaders(); WorkbasketReport report = @@ -238,7 +233,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfWorkbasketReportWithStateFilter() throws Exception { - List states = Collections.singletonList(TaskState.READY); + List states = List.of(TaskState.READY); List columnHeaders = getShortListOfColumnHeaders(); WorkbasketReport report = @@ -292,7 +287,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { @WithAccessId(user = "monitor") @Test void testEachItemOfWorkbasketReportWithDomainFilter() throws Exception { - List domains = Collections.singletonList("DOMAIN_A"); + List domains = List.of("DOMAIN_A"); List columnHeaders = getShortListOfColumnHeaders(); WorkbasketReport report = @@ -415,7 +410,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { throws Exception { List columnHeaders = getListOfColumnHeaders(); List combinedClassificationFilters = - Collections.singletonList( + List.of( new CombinedClassificationFilter( "CLI:000000000000000000000000000000000001", "CLI:000000000000000000000000000000000006")); diff --git a/lib/taskana-core/src/test/java/acceptance/task/CompleteTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/CompleteTaskAccTest.java index 2b0c2916a..b9dc36fc2 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/CompleteTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/CompleteTaskAccTest.java @@ -7,7 +7,6 @@ import acceptance.AbstractAccTest; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Arrays; -import java.util.Collections; import java.util.List; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.junit.jupiter.api.Test; @@ -342,7 +341,7 @@ class CompleteTaskAccTest extends AbstractAccTest { @Test void should_AddErrorForTaskWhichIsNotClaimed_When_BulkCompletingTasks() throws Exception { String id = "TKI:000000000000000000000000000000000025"; // task is not claimed - List taskIdList = Collections.singletonList(id); + List taskIdList = List.of(id); BulkOperationResults results = TASK_SERVICE.completeTasks(taskIdList); @@ -375,7 +374,7 @@ class CompleteTaskAccTest extends AbstractAccTest { @Test void should_DoNothingForCompletedTask_When_BulkCompletingTasks() throws Exception { String id = "TKI:000000000000000000000000000000000036"; // task is completed - List taskIdList = Collections.singletonList(id); + List taskIdList = List.of(id); Task before = TASK_SERVICE.getTask(id); BulkOperationResults results = TASK_SERVICE.completeTasks(taskIdList); @@ -389,7 +388,7 @@ class CompleteTaskAccTest extends AbstractAccTest { @Test void should_AddErrorForTaskIfOwnerDoesNotMach_When_BulkCompletingTasks() throws Exception { String id1 = "TKI:000000000000000000000000000000000035"; - List taskIdList = Collections.singletonList(id1); + List taskIdList = List.of(id1); BulkOperationResults results = TASK_SERVICE.completeTasks(taskIdList); @@ -487,7 +486,7 @@ class CompleteTaskAccTest extends AbstractAccTest { @Test void should_DoNothingForCompletedTask_When_BulkForceCompletingTasks() throws Exception { String id = "TKI:000000000000000000000000000000000036"; // task is completed - List taskIdList = Collections.singletonList(id); + List taskIdList = List.of(id); Task before = TASK_SERVICE.getTask(id); BulkOperationResults results = @@ -503,7 +502,7 @@ class CompleteTaskAccTest extends AbstractAccTest { void should_CompleteTaskWhenAlreadyClaimedByDifferentUser_When_BulkForceCompletingTasks() throws Exception { String id = "TKI:000000000000000000000000000000000002"; - List taskIdList = Collections.singletonList(id); + List taskIdList = List.of(id); Task beforeClaim = TASK_SERVICE.getTask(id); assertThat(beforeClaim.getOwner()).isNotEqualTo("user-1-2"); @@ -525,7 +524,7 @@ class CompleteTaskAccTest extends AbstractAccTest { @Test void should_ClaimTaskWhenNotClaimed_When_BulkForceCompletingTasks() throws Exception { String id = "TKI:000000000000000000000000000000000033"; - List taskIdList = Collections.singletonList(id); + List taskIdList = List.of(id); Task task = TASK_SERVICE.getTask(id); assertThat(task.getState()).isSameAs(TaskState.READY); diff --git a/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityAccTest.java index 28062ce09..e2772d7d1 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityAccTest.java @@ -10,7 +10,6 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.assertj.core.data.TemporalUnitWithinOffset; @@ -391,7 +390,7 @@ class ServiceLevelPriorityAccTest extends AbstractAccTest { Instant planned = getInstant("2020-05-03T07:00:00"); // test bulk operation setPlanned... BulkOperationResults results = - taskService.setPlannedPropertyOfTasks(planned, Collections.singletonList(taskId)); + taskService.setPlannedPropertyOfTasks(planned, List.of(taskId)); Task task = taskService.getTask(taskId); assertThat(results.containsErrors()).isFalse(); Instant expectedDue = converter.addWorkingDaysToInstant(task.getPlanned(), Duration.ofDays(1)); diff --git a/lib/taskana-core/src/test/java/acceptance/task/SetOwnerAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/SetOwnerAccTest.java index e402b272a..cbc472869 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/SetOwnerAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/SetOwnerAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import acceptance.AbstractAccTest; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map.Entry; import java.util.stream.Collectors; @@ -89,7 +88,7 @@ class SetOwnerAccTest extends AbstractAccTest { assertThatThrownBy(() -> taskService.getTask(taskReadyId)) .isInstanceOf(NotAuthorizedException.class); BulkOperationResults results = - taskService.setOwnerOfTasks(anyUserName, Collections.singletonList(taskReadyId)); + taskService.setOwnerOfTasks(anyUserName, List.of(taskReadyId)); assertThat(results.containsErrors()).isTrue(); assertThat(results.getErrorForId(taskReadyId)).isInstanceOf(NotAuthorizedException.class); } diff --git a/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java index 0b4717731..89966b5a3 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java @@ -8,7 +8,6 @@ import acceptance.AbstractAccTest; import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.junit.jupiter.api.Test; @@ -310,7 +309,7 @@ class TransferTaskAccTest extends AbstractAccTest { @Test void should_TransferTasks_When_TransferTasksWithListNotSupportingRemove() { TaskService taskService = taskanaEngine.getTaskService(); - List taskIds = Collections.singletonList("TKI:000000000000000000000000000000000006"); + List taskIds = List.of("TKI:000000000000000000000000000000000006"); ThrowingCallable call = () -> { diff --git a/lib/taskana-core/src/test/java/acceptance/workbasket/DistributionTargetsAccTest.java b/lib/taskana-core/src/test/java/acceptance/workbasket/DistributionTargetsAccTest.java index 827a46653..5b6c9c511 100644 --- a/lib/taskana-core/src/test/java/acceptance/workbasket/DistributionTargetsAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/workbasket/DistributionTargetsAccTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import acceptance.AbstractAccTest; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; @@ -88,8 +87,7 @@ class DistributionTargetsAccTest extends AbstractAccTest { call = () -> { - workbasketService.setDistributionTargets( - existingWb, Collections.singletonList(nonExistingWb)); + workbasketService.setDistributionTargets(existingWb, List.of(nonExistingWb)); }; assertThatThrownBy(call).isInstanceOf(WorkbasketNotFoundException.class); @@ -128,7 +126,7 @@ class DistributionTargetsAccTest extends AbstractAccTest { ThrowingCallable call = () -> { workbasketService.setDistributionTargets( - existingWb, Collections.singletonList("WBI:100000000000000000000000000000000002")); + existingWb, List.of("WBI:100000000000000000000000000000000002")); }; assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class); diff --git a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationClassificationCategoryReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationClassificationCategoryReportBuilderImplTest.java index 71bfda339..664ef090f 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationClassificationCategoryReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationClassificationCategoryReportBuilderImplTest.java @@ -10,7 +10,6 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -53,13 +52,12 @@ class ClassificationClassificationCategoryReportBuilderImplTest { @Test void testGetTotalNumbersOfCatgoryReport() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); @@ -110,17 +108,16 @@ class ClassificationClassificationCategoryReportBuilderImplTest { @Test void testGetCategoryReportWithReportLineItemDefinitions() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); final List expectedResult = new ArrayList<>(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); @@ -172,23 +169,20 @@ class ClassificationClassificationCategoryReportBuilderImplTest { @Test void testListTaskIdsOfCategoryReportForSelectedItems() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); final Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - List selectedItems = - Collections.singletonList(new SelectedItem("EXTERN", null, 1, 5)); + List selectedItems = List.of(new SelectedItem("EXTERN", null, 1, 5)); - List expectedResult = - Collections.singletonList("TKI:000000000000000000000000000000000001"); + List expectedResult = List.of("TKI:000000000000000000000000000000000001"); when(monitorMapperMock.getTaskIdsForSelectedItems( workbasketIds, states, @@ -249,25 +243,24 @@ class ClassificationClassificationCategoryReportBuilderImplTest { List result = cut.createClassificationCategoryReportBuilder() .listTaskIdsForSelectedItems( - Collections.singletonList(new SelectedItem("BLA", null, 0, 0)), TaskTimestamp.DUE); + List.of(new SelectedItem("BLA", null, 0, 0)), TaskTimestamp.DUE); assertThat(result).isNotNull(); } @Test void testListCustomAttributeValuesForCustomAttributeName() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - List expectedResult = Collections.singletonList("Geschaeftsstelle A"); + List expectedResult = List.of("Geschaeftsstelle A"); when(monitorMapperMock.getCustomAttributeValuesForReport( workbasketIds, states, @@ -313,7 +306,7 @@ class ClassificationClassificationCategoryReportBuilderImplTest { void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws Exception { List result = cut.createClassificationCategoryReportBuilder() - .workbasketIdIn(Collections.singletonList("DieGibtsSicherNed")) + .workbasketIdIn(List.of("DieGibtsSicherNed")) .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_1); assertThat(result).isNotNull(); } diff --git a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationReportBuilderImplTest.java index 971144414..730e41e0e 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/ClassificationReportBuilderImplTest.java @@ -67,13 +67,12 @@ class ClassificationReportBuilderImplTest { @Test void testGetTotalNumbersOfClassificationReport() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); @@ -131,18 +130,17 @@ class ClassificationReportBuilderImplTest { @Test void testGetClassificationReportWithReportLineItemDefinitions() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); final List expectedResult = new ArrayList<>(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); @@ -200,13 +198,12 @@ class ClassificationReportBuilderImplTest { @Test void testGetTotalNumbersOfDetailedClassificationReport() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); @@ -267,17 +264,16 @@ class ClassificationReportBuilderImplTest { @Test void testGetDetailedClassificationReportWithReportLineItemDefinitions() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); final List expectedResult = new ArrayList<>(); DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem(); @@ -342,23 +338,20 @@ class ClassificationReportBuilderImplTest { @Test void testGetTaskIdsForSelectedItems() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - final List selectedItems = - Collections.singletonList(new SelectedItem("EXTERN", null, 1, 5)); + final List selectedItems = List.of(new SelectedItem("EXTERN", null, 1, 5)); - final List expectedResult = - Collections.singletonList("TKI:000000000000000000000000000000000001"); + final List expectedResult = List.of("TKI:000000000000000000000000000000000001"); when(monitorMapperMock.getTaskIdsForSelectedItems( workbasketIds, states, @@ -414,30 +407,28 @@ class ClassificationReportBuilderImplTest { @Test void testGetTaskIdsForSelectedItemsIsEmptyResult() throws Exception { - List selectedItems = - Collections.singletonList(new SelectedItem("GIBTSNED", null, 0, 0)); + List selectedItems = List.of(new SelectedItem("GIBTSNED", null, 0, 0)); List result = cut.createClassificationReportBuilder() - .workbasketIdIn(Collections.singletonList("DieGibtsEhNed")) + .workbasketIdIn(List.of("DieGibtsEhNed")) .listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE); assertThat(result).isNotNull(); } @Test void testListCustomAttributeValuesForCustomAttributeName() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - final List expectedResult = Collections.singletonList("Geschaeftsstelle A"); + final List expectedResult = List.of("Geschaeftsstelle A"); when(monitorMapperMock.getCustomAttributeValuesForReport( workbasketIds, states, @@ -482,7 +473,7 @@ class ClassificationReportBuilderImplTest { void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws Exception { List result = cut.createClassificationReportBuilder() - .workbasketIdIn(Collections.singletonList("DieGibtsGarantiertNed")) + .workbasketIdIn(List.of("DieGibtsGarantiertNed")) .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_10); assertThat(result).isNotNull(); } diff --git a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/TaskCustomFieldValueReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/TaskCustomFieldValueReportBuilderImplTest.java index 7075a906c..203085c88 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/TaskCustomFieldValueReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/TaskCustomFieldValueReportBuilderImplTest.java @@ -9,7 +9,6 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,13 +50,12 @@ class TaskCustomFieldValueReportBuilderImplTest { @Test void testGetTotalNumbersOfCustomFieldValueReport() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); @@ -110,17 +108,16 @@ class TaskCustomFieldValueReportBuilderImplTest { @Test void testGetCustomFieldValueReportWithReportLineItemDefinitions() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); final List expectedResult = new ArrayList<>(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); @@ -174,19 +171,18 @@ class TaskCustomFieldValueReportBuilderImplTest { @Test void testListCustomAttributeValuesForCustomAttributeName() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - List expectedResult = Collections.singletonList("Geschaeftsstelle A"); + List expectedResult = List.of("Geschaeftsstelle A"); when(monitorMapperMock.getCustomAttributeValuesForReport( workbasketIds, states, diff --git a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/WorkbasketReportBuilderImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/WorkbasketReportBuilderImplTest.java index 058690761..11df3e731 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/WorkbasketReportBuilderImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/monitor/internal/WorkbasketReportBuilderImplTest.java @@ -55,17 +55,16 @@ class WorkbasketReportBuilderImplTest { @Test void testGetTotalNumbersOfWorkbasketReportBasedOnDueDate() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List combinedClassificationFilter = - Collections.singletonList( + List.of( new CombinedClassificationFilter( "CLI:000000000000000000000000000000000003", "CLI:000000000000000000000000000000000008")); @@ -119,22 +118,21 @@ class WorkbasketReportBuilderImplTest { @Test void testGetWorkbasketReportWithReportLineItemDefinitions() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List combinedClassificationFilter = - Collections.singletonList( + List.of( new CombinedClassificationFilter( "CLI:000000000000000000000000000000000003", "CLI:000000000000000000000000000000000008")); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); final List expectedResult = new ArrayList<>(); MonitorQueryItem monitorQueryItem = new MonitorQueryItem(); @@ -188,23 +186,20 @@ class WorkbasketReportBuilderImplTest { @Test void testGetTaskIdsOfCategoryReportForSelectedItems() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - List selectedItems = - Collections.singletonList(new SelectedItem("EXTERN", null, 1, 5)); + List selectedItems = List.of(new SelectedItem("EXTERN", null, 1, 5)); - List expectedResult = - Collections.singletonList("TKI:000000000000000000000000000000000001"); + List expectedResult = List.of("TKI:000000000000000000000000000000000001"); when(monitorMapperMock.getTaskIdsForSelectedItems( workbasketIds, states, @@ -265,7 +260,7 @@ class WorkbasketReportBuilderImplTest { () -> { List result = cut.createWorkbasketReportBuilder() - .workbasketIdIn(Collections.singletonList("DieGibtsGarantiertNed")) + .workbasketIdIn(List.of("DieGibtsGarantiertNed")) .listTaskIdsForSelectedItems(selectedItems, TaskTimestamp.DUE); assertThat(result).isNotNull(); }; @@ -274,19 +269,18 @@ class WorkbasketReportBuilderImplTest { @Test void testListCustomAttributeValuesForCustomAttributeName() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List columnHeaders = - Collections.singletonList(new TimeIntervalColumnHeader(0, 0)); + List.of(new TimeIntervalColumnHeader(0, 0)); - List expectedResult = Collections.singletonList("Geschaeftsstelle A"); + List expectedResult = List.of("Geschaeftsstelle A"); when(monitorMapperMock.getCustomAttributeValuesForReport( workbasketIds, states, @@ -330,24 +324,23 @@ class WorkbasketReportBuilderImplTest { void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws Exception { List result = cut.createWorkbasketReportBuilder() - .workbasketIdIn(Collections.singletonList("GibtsSicherNed")) + .workbasketIdIn(List.of("GibtsSicherNed")) .listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_14); assertThat(result).isNotNull(); } @Test void testGetTotalNumbersOfWorkbasketReportBasedOnCreatedDate() throws Exception { - final List workbasketIds = - Collections.singletonList("WBI:000000000000000000000000000000000001"); + final List workbasketIds = List.of("WBI:000000000000000000000000000000000001"); final List states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); - final List categories = Collections.singletonList("EXTERN"); - final List domains = Collections.singletonList("DOMAIN_A"); - final List classificationIds = Collections.singletonList("L10000"); - final List excludedClassificationIds = Collections.singletonList("L20000"); + final List categories = List.of("EXTERN"); + final List domains = List.of("DOMAIN_A"); + final List classificationIds = List.of("L10000"); + final List excludedClassificationIds = List.of("L20000"); Map customAttributeFilter = new HashMap<>(); customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A"); final List combinedClassificationFilter = - Collections.singletonList( + List.of( new CombinedClassificationFilter( "CLI:000000000000000000000000000000000003", "CLI:000000000000000000000000000000000008")); diff --git a/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntAutocommitTest.java b/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntAutocommitTest.java index a99ab8185..f24e5e931 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntAutocommitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntAutocommitTest.java @@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Arrays; -import java.util.Collections; import java.util.List; import javax.sql.DataSource; import org.junit.jupiter.api.BeforeAll; @@ -93,7 +92,7 @@ class WorkbasketServiceImplIntAutocommitTest { workbasket3 = workBasketService.createWorkbasket(workbasket3); createWorkbasketWithSecurity(workbasket3, "user-1-1", true, true, false, false); - List newDistTargets = Collections.singletonList(workbasket3.getId()); + List newDistTargets = List.of(workbasket3.getId()); Thread.sleep(SLEEP_TIME); workBasketService.setDistributionTargets(workbasket2.getId(), newDistTargets); diff --git a/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntExplicitTest.java b/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntExplicitTest.java index 114b176f1..c4d6d9ac2 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntExplicitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplIntExplicitTest.java @@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat; import java.sql.Connection; import java.util.Arrays; -import java.util.Collections; import java.util.List; import javax.sql.DataSource; import org.junit.jupiter.api.AfterEach; @@ -96,7 +95,7 @@ class WorkbasketServiceImplIntExplicitTest { workbasket3 = workBasketService.createWorkbasket(workbasket3); createWorkbasketWithSecurity(workbasket3, "user-1-1", true, true, false, false); - List newDistTargets = Collections.singletonList(workbasket3.getId()); + List newDistTargets = List.of(workbasket3.getId()); Thread.sleep(SLEEP_TIME); workBasketService.setDistributionTargets(workbasket2.getId(), newDistTargets); diff --git a/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplTest.java index b2c5334bf..72173e134 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/workbasket/internal/WorkbasketServiceImplTest.java @@ -15,7 +15,6 @@ import static org.mockito.Mockito.when; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -112,7 +111,7 @@ class WorkbasketServiceImplTest { WorkbasketImpl expectedWb = createTestWorkbasket("ID-1", "Key-1"); when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true); String otherWorkbasketId = "4711"; - List destinations = Collections.singletonList(otherWorkbasketId); + List destinations = List.of(otherWorkbasketId); workbasketServiceSpy.createWorkbasket(expectedWb); doReturn(expectedWb).when(workbasketServiceSpy).getWorkbasket(eq(expectedWb.getId())); diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java index 10075782c..223fa2201 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerIntTest.java @@ -11,7 +11,7 @@ import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import java.time.Instant; import java.util.Arrays; -import java.util.Collections; +import java.util.List; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -131,8 +131,7 @@ class ClassificationDefinitionControllerIntTest { classification.setCustom8("custom"); TaskanaPagedModel clList = - new TaskanaPagedModel<>( - TaskanaPagedModelKeys.CLASSIFICATIONS, Collections.singletonList(classification)); + new TaskanaPagedModel<>(TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(classification)); ResponseEntity response = importRequest(clList); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT); @@ -143,8 +142,7 @@ class ClassificationDefinitionControllerIntTest { ClassificationRepresentationModel classification = new ClassificationRepresentationModel(); classification.setDomain("DOMAIN_A"); TaskanaPagedModel clList = - new TaskanaPagedModel<>( - TaskanaPagedModelKeys.CLASSIFICATIONS, Collections.singletonList(classification)); + new TaskanaPagedModel<>(TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(classification)); try { importRequest(clList); @@ -158,8 +156,7 @@ class ClassificationDefinitionControllerIntTest { ClassificationRepresentationModel classification = new ClassificationRepresentationModel(); classification.setKey("one"); TaskanaPagedModel clList = - new TaskanaPagedModel<>( - TaskanaPagedModelKeys.CLASSIFICATIONS, Collections.singletonList(classification)); + new TaskanaPagedModel<>(TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(classification)); try { importRequest(clList); @@ -174,8 +171,7 @@ class ClassificationDefinitionControllerIntTest { getClassificationWithKeyAndDomain("T6310", ""); classification.setType("DOCUMENT"); TaskanaPagedModel clList = - new TaskanaPagedModel<>( - TaskanaPagedModelKeys.CLASSIFICATIONS, Collections.singletonList(classification)); + new TaskanaPagedModel<>(TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(classification)); assertThatThrownBy(() -> importRequest(clList)) .isInstanceOf(HttpClientErrorException.class) @@ -237,8 +233,7 @@ class ClassificationDefinitionControllerIntTest { TaskanaPagedModel clList = new TaskanaPagedModel<>( - TaskanaPagedModelKeys.CLASSIFICATIONS, - Collections.singletonList(existingClassification)); + TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(existingClassification)); ResponseEntity response = importRequest(clList); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT); @@ -246,8 +241,7 @@ class ClassificationDefinitionControllerIntTest { existingClassification.setName("second new Name"); clList = new TaskanaPagedModel<>( - TaskanaPagedModelKeys.CLASSIFICATIONS, - Collections.singletonList(existingClassification)); + TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(existingClassification)); response = importRequest(clList); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT); diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QueryHelperTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QueryHelperTest.java index c979b6ae6..567e29698 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QueryHelperTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QueryHelperTest.java @@ -14,7 +14,6 @@ import static pro.taskana.common.rest.QueryHelper.applyAndRemoveSortingParams; import java.util.AbstractMap.SimpleEntry; import java.util.Arrays; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.stream.Stream; @@ -35,8 +34,8 @@ class QueryHelperTest { @Test void should_RemoveSortByAndOrderDirection_When_ApplyingSortingParams() throws Exception { MultiValueMap map = new LinkedMultiValueMap<>(); - map.put(QueryHelper.SORT_BY, Collections.singletonList("sort-by")); - map.put(QueryHelper.ORDER_DIRECTION, Collections.singletonList("order")); + map.put(QueryHelper.SORT_BY, List.of("sort-by")); + map.put(QueryHelper.ORDER_DIRECTION, List.of("order")); applyAndRemoveSortingParams(map, mock(MockBiConsumer.class)); assertThat(map).isEmpty(); @@ -46,9 +45,9 @@ class QueryHelperTest { void should_IgnoreMapContent_When_ApplyingSortingParams() throws Exception { MultiValueMap map = new LinkedMultiValueMap<>(); String key = "unknown"; - List value = Collections.singletonList("sort-by"); + List value = List.of("sort-by"); map.put(key, value); - map.put(QueryHelper.SORT_BY, Collections.singletonList("sort-by")); + map.put(QueryHelper.SORT_BY, List.of("sort-by")); applyAndRemoveSortingParams(map, mock(MockBiConsumer.class)); assertThat(map).containsExactly(new SimpleEntry<>(key, value)); @@ -67,7 +66,7 @@ class QueryHelperTest { @Test void should_CallConsumerWithSortByValue_When_MapContainsOneSortBy() throws Exception { MultiValueMap map = new LinkedMultiValueMap<>(); - map.put(QueryHelper.SORT_BY, Collections.singletonList("sort-by-value")); + map.put(QueryHelper.SORT_BY, List.of("sort-by-value")); MockBiConsumer consumer = mock(MockBiConsumer.class); applyAndRemoveSortingParams(map, consumer); @@ -79,7 +78,7 @@ class QueryHelperTest { void should_CallConsumerWithAscSortDirection_When_MapDoesNotContainSortDirection() throws Exception { MultiValueMap map = new LinkedMultiValueMap<>(); - map.put(QueryHelper.SORT_BY, Collections.singletonList("sort-by-value")); + map.put(QueryHelper.SORT_BY, List.of("sort-by-value")); MockBiConsumer consumer = mock(MockBiConsumer.class); applyAndRemoveSortingParams(map, consumer); @@ -94,8 +93,8 @@ class QueryHelperTest { ThrowingConsumer test = desc -> { MultiValueMap map = new LinkedMultiValueMap<>(); - map.put(QueryHelper.SORT_BY, Collections.singletonList("sort-by-value")); - map.put(QueryHelper.ORDER_DIRECTION, Collections.singletonList(desc)); + map.put(QueryHelper.SORT_BY, List.of("sort-by-value")); + map.put(QueryHelper.ORDER_DIRECTION, List.of(desc)); MockBiConsumer consumer = mock(MockBiConsumer.class); applyAndRemoveSortingParams(map, consumer); @@ -136,7 +135,7 @@ class QueryHelperTest { @Test void should_ThrowError_When_MapContainsOrderByButNoSortBy() { MultiValueMap map = new LinkedMultiValueMap<>(); - map.put(QueryHelper.ORDER_DIRECTION, Collections.singletonList("desc")); + map.put(QueryHelper.ORDER_DIRECTION, List.of("desc")); assertThatThrownBy(() -> applyAndRemoveSortingParams(map, mock(MockBiConsumer.class))) .isInstanceOf(InvalidArgumentException.class); } @@ -145,7 +144,7 @@ class QueryHelperTest { void should_ThrowError_When_SortByAndOrderByCountDoesNotMatch() { MultiValueMap map = new LinkedMultiValueMap<>(); map.put(QueryHelper.SORT_BY, Arrays.asList("1", "2")); - map.put(QueryHelper.ORDER_DIRECTION, Collections.singletonList("desc")); + map.put(QueryHelper.ORDER_DIRECTION, List.of("desc")); assertThatThrownBy(() -> applyAndRemoveSortingParams(map, mock(MockBiConsumer.class))) .isInstanceOf(InvalidArgumentException.class); } @@ -153,7 +152,7 @@ class QueryHelperTest { @Test void should_ThrowError_When_ConsumerRaisesException() throws Exception { MultiValueMap map = new LinkedMultiValueMap<>(); - map.put(QueryHelper.SORT_BY, Collections.singletonList("1")); + map.put(QueryHelper.SORT_BY, List.of("1")); MockBiConsumer consumer = mock(MockBiConsumer.class); doThrow(new InvalidArgumentException("")).when(consumer).accept(any(), any()); assertThatThrownBy(() -> applyAndRemoveSortingParams(map, consumer)) diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/ldap/LdapClientTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/ldap/LdapClientTest.java index 7f95ce602..a3c266ff9 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/ldap/LdapClientTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/ldap/LdapClientTest.java @@ -10,7 +10,6 @@ import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -58,10 +57,10 @@ class LdapClientTest { when(ldapTemplate.search( any(String.class), any(), anyInt(), any(), any(LdapClient.GroupContextMapper.class))) - .thenReturn(Collections.singletonList(group)); + .thenReturn(List.of(group)); when(ldapTemplate.search( any(String.class), any(), anyInt(), any(), any(LdapClient.UserContextMapper.class))) - .thenReturn(Collections.singletonList(user)); + .thenReturn(List.of(user)); assertThat(cut.searchUsersAndGroups("test")).hasSize(2).containsExactlyInAnyOrder(user, group); } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssemberTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssemberTest.java index 5e4eab3af..269fcce3e 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssemberTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskRepresentationModelAssemberTest.java @@ -90,11 +90,9 @@ class TaskRepresentationModelAssemberTest { repModel.setPrimaryObjRef(primaryObjRef); repModel.setRead(true); repModel.setTransferred(true); - repModel.setCustomAttributes( - Collections.singletonList(TaskRepresentationModel.CustomAttribute.of("abc", "def"))); - repModel.setCallbackInfo( - Collections.singletonList(TaskRepresentationModel.CustomAttribute.of("ghi", "jkl"))); - repModel.setAttachments(Collections.singletonList(attachment)); + repModel.setCustomAttributes(List.of(TaskRepresentationModel.CustomAttribute.of("abc", "def"))); + repModel.setCallbackInfo(List.of(TaskRepresentationModel.CustomAttribute.of("ghi", "jkl"))); + repModel.setAttachments(List.of(attachment)); repModel.setCustom1("custom1"); repModel.setCustom2("custom2"); repModel.setCustom3("custom3"); @@ -154,7 +152,7 @@ class TaskRepresentationModelAssemberTest { task.setTransferred(true); task.setCustomAttributeMap(Collections.singletonMap("abc", "def")); task.setCallbackInfo(Collections.singletonMap("ghi", "jkl")); - task.setAttachments(Collections.singletonList(attachment)); + task.setAttachments(List.of(attachment)); task.setCustomAttribute(TaskCustomField.CUSTOM_1, "custom1"); task.setCustomAttribute(TaskCustomField.CUSTOM_2, "custom2"); task.setCustomAttribute(TaskCustomField.CUSTOM_3, "custom3"); @@ -215,7 +213,7 @@ class TaskRepresentationModelAssemberTest { task.setTransferred(true); task.setCustomAttributeMap(Collections.singletonMap("abc", "def")); task.setCallbackInfo(Collections.singletonMap("ghi", "jkl")); - task.setAttachments(Collections.singletonList(attachment)); + task.setAttachments(List.of(attachment)); task.setCustom1("custom1"); task.setCustom2("custom2"); task.setCustom3("custom3"); diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssemblerTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssemblerTest.java index 74432c5aa..afc78828d 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssemblerTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/assembler/TaskSummaryRepresentationModelAssemblerTest.java @@ -19,7 +19,6 @@ import static pro.taskana.task.api.TaskCustomField.CUSTOM_8; import static pro.taskana.task.api.TaskCustomField.CUSTOM_9; import java.time.Instant; -import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -77,7 +76,7 @@ class TaskSummaryRepresentationModelAssemblerTest { final WorkbasketSummary workbasket = this.workbasketService.newWorkbasket("key", "domain").asSummary(); TaskSummaryImpl task = (TaskSummaryImpl) this.taskService.newTask().asSummary(); - task.setAttachmentSummaries(Collections.singletonList(attachment)); + task.setAttachmentSummaries(List.of(attachment)); task.setClassificationSummary(classification); task.setWorkbasketSummary(workbasket); task.setId("taskId"); @@ -139,7 +138,7 @@ class TaskSummaryRepresentationModelAssemblerTest { attachment.setClassificationSummary(classificationSummary); attachment.setAttachmentId("attachmentId"); TaskSummaryRepresentationModel repModel = new TaskRepresentationModel(); - repModel.setAttachmentSummaries(Collections.singletonList(attachment)); + repModel.setAttachmentSummaries(List.of(attachment)); repModel.setClassificationSummary(classificationSummary); repModel.setWorkbasketSummary(workbasketResource); repModel.setPrimaryObjRef(primaryObjRef);