TSK-1282: replaced Collections.singletonList with List.of in all tests

This commit is contained in:
Mustapha Zorgati 2020-10-30 11:07:09 +01:00
parent c25075ab25
commit 0eb877705b
30 changed files with 222 additions and 305 deletions

View File

@ -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<String> tasksWithP8D =
new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000008"));
new ArrayList<>(List.of("TKI:000000000000000000000000000000000008"));
validateTaskPropertiesAfterClassificationChange(
before, tasksWithP8D, taskService, converter, 8, 1000);
List<String> 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<String> 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<String> 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<String> tasksWithPD8 =
new ArrayList<>(Collections.singletonList("TKI:000000000000000000000000000000000008"));
new ArrayList<>(List.of("TKI:000000000000000000000000000000000008"));
validateTaskPropertiesAfterClassificationChange(
before, tasksWithPD8, taskService, converter, 8, 555);

View File

@ -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<String> 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<String> 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);

View File

@ -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<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0));
final List<TimeIntervalColumnHeader> columnHeaders = List.of(new TimeIntervalColumnHeader(0));
final List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("EXTERN", null, 0, 0));
final List<SelectedItem> selectedItems = List.of(new SelectedItem("EXTERN", null, 0, 0));
List<String> ids =
MONITOR_SERVICE
@ -122,8 +120,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithWorkbasketFilter() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<SelectedItem> selectedItems = Arrays.asList(EXTERN, AUTOMATIC, MANUAL);
@ -147,7 +144,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithStateFilter() throws Exception {
final List<TaskState> states = Collections.singletonList(TaskState.READY);
final List<TaskState> states = List.of(TaskState.READY);
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<SelectedItem> selectedItems = Arrays.asList(EXTERN, AUTOMATIC, MANUAL);
@ -201,7 +198,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithDomainFilter() throws Exception {
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> domains = List.of("DOMAIN_A");
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<SelectedItem> selectedItems = Arrays.asList(EXTERN, AUTOMATIC, MANUAL);
@ -253,8 +250,7 @@ class GetTaskIdsOfClassificationCategoryReportAccTest extends AbstractReportAccT
void testThrowsExceptionIfSubKeysAreUsed() {
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("EXTERN", "INVALID", -5, -2));
final List<SelectedItem> selectedItems = List.of(new SelectedItem("EXTERN", "INVALID", -5, -2));
ThrowingCallable call =
() ->

View File

@ -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();
};

View File

@ -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<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> selectedItems =
Collections.singletonList(
new SelectedItem("Geschaeftsstelle A", null, Integer.MIN_VALUE, -5));
List.of(new SelectedItem("Geschaeftsstelle A", null, Integer.MIN_VALUE, -5));
List<String> ids =
MONITOR_SERVICE
@ -119,8 +117,7 @@ class GetTaskIdsOfTaskCustomFieldValueReportAccTest extends AbstractReportAccTes
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReportWithWorkbasketFilter() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<SelectedItem> 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<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("Geschaeftsstelle A", "INVALID", -5, -2));
List.of(new SelectedItem("Geschaeftsstelle A", "INVALID", -5, -2));
ThrowingCallable call =
() ->

View File

@ -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<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
final List<SelectedItem> 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<CombinedClassificationFilter> combinedClassificationFilters =
Arrays.asList(
new CombinedClassificationFilter(

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
ClassificationCategoryReport report =
@ -252,7 +249,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithStateFilter() throws Exception {
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TaskState> states = List.of(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
ClassificationCategoryReport report =
@ -303,7 +300,7 @@ class ProvideClassificationCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithDomainFilter() throws Exception {
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> domains = List.of("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
ClassificationCategoryReport report =

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
ClassificationReport report =
@ -277,7 +274,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithStateFilter() throws Exception {
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TaskState> states = List.of(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
ClassificationReport report =
@ -334,7 +331,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithDomainFilter() throws Exception {
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> domains = List.of("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
ClassificationReport report =

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
DetailedClassificationReport report =
@ -389,7 +386,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithStateFilter() throws Exception {
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TaskState> states = List.of(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
DetailedClassificationReport report =
@ -539,7 +536,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithDomainFilter() throws Exception {
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> domains = List.of("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
DetailedClassificationReport report =

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
TaskCustomFieldValueReport report =
@ -267,7 +265,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithStateFilter() throws Exception {
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TaskState> states = List.of(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
TaskCustomFieldValueReport report =
@ -321,7 +319,7 @@ class ProvideTaskCustomFieldValueReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithDomainFilter() throws Exception {
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> domains = List.of("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
TaskCustomFieldValueReport report =

View File

@ -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();

View File

@ -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<String> org1Set = new HashSet<>(Arrays.asList("N/A", "org1"));
final HashSet<String> allOtherOrgLevelSet = new HashSet<>(Collections.singletonList("N/A"));
final HashSet<String> allOtherOrgLevelSet = new HashSet<>(List.of("N/A"));
assertThat(timestampReport.getRows()).hasSize(2);
assertThat(timestampReport.getRows().keySet())

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
WorkbasketReport report =
@ -238,7 +233,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithStateFilter() throws Exception {
List<TaskState> states = Collections.singletonList(TaskState.READY);
List<TaskState> states = List.of(TaskState.READY);
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
WorkbasketReport report =
@ -292,7 +287,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithDomainFilter() throws Exception {
List<String> domains = Collections.singletonList("DOMAIN_A");
List<String> domains = List.of("DOMAIN_A");
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
WorkbasketReport report =
@ -415,7 +410,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
throws Exception {
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
List<CombinedClassificationFilter> combinedClassificationFilters =
Collections.singletonList(
List.of(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000001",
"CLI:000000000000000000000000000000000006"));

View File

@ -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<String> taskIdList = Collections.singletonList(id);
List<String> taskIdList = List.of(id);
BulkOperationResults<String, TaskanaException> 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<String> taskIdList = Collections.singletonList(id);
List<String> taskIdList = List.of(id);
Task before = TASK_SERVICE.getTask(id);
BulkOperationResults<String, TaskanaException> 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<String> taskIdList = Collections.singletonList(id1);
List<String> taskIdList = List.of(id1);
BulkOperationResults<String, TaskanaException> 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<String> taskIdList = Collections.singletonList(id);
List<String> taskIdList = List.of(id);
Task before = TASK_SERVICE.getTask(id);
BulkOperationResults<String, TaskanaException> results =
@ -503,7 +502,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
void should_CompleteTaskWhenAlreadyClaimedByDifferentUser_When_BulkForceCompletingTasks()
throws Exception {
String id = "TKI:000000000000000000000000000000000002";
List<String> taskIdList = Collections.singletonList(id);
List<String> 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<String> taskIdList = Collections.singletonList(id);
List<String> taskIdList = List.of(id);
Task task = TASK_SERVICE.getTask(id);
assertThat(task.getState()).isSameAs(TaskState.READY);

View File

@ -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<String, TaskanaException> 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));

View File

@ -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<String, TaskanaException> results =
taskService.setOwnerOfTasks(anyUserName, Collections.singletonList(taskReadyId));
taskService.setOwnerOfTasks(anyUserName, List.of(taskReadyId));
assertThat(results.containsErrors()).isTrue();
assertThat(results.getErrorForId(taskReadyId)).isInstanceOf(NotAuthorizedException.class);
}

View File

@ -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<String> taskIds = Collections.singletonList("TKI:000000000000000000000000000000000006");
List<String> taskIds = List.of("TKI:000000000000000000000000000000000006");
ThrowingCallable call =
() -> {

View File

@ -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);

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
@ -110,17 +108,16 @@ class ClassificationClassificationCategoryReportBuilderImplTest {
@Test
void testGetCategoryReportWithReportLineItemDefinitions() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -172,23 +169,20 @@ class ClassificationClassificationCategoryReportBuilderImplTest {
@Test
void testListTaskIdsOfCategoryReportForSelectedItems() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
final Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("EXTERN", null, 1, 5));
List<SelectedItem> selectedItems = List.of(new SelectedItem("EXTERN", null, 1, 5));
List<String> expectedResult =
Collections.singletonList("TKI:000000000000000000000000000000000001");
List<String> expectedResult = List.of("TKI:000000000000000000000000000000000001");
when(monitorMapperMock.getTaskIdsForSelectedItems(
workbasketIds,
states,
@ -249,25 +243,24 @@ class ClassificationClassificationCategoryReportBuilderImplTest {
List<String> 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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
List<String> expectedResult = List.of("Geschaeftsstelle A");
when(monitorMapperMock.getCustomAttributeValuesForReport(
workbasketIds,
states,
@ -313,7 +306,7 @@ class ClassificationClassificationCategoryReportBuilderImplTest {
void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws Exception {
List<String> result =
cut.createClassificationCategoryReportBuilder()
.workbasketIdIn(Collections.singletonList("DieGibtsSicherNed"))
.workbasketIdIn(List.of("DieGibtsSicherNed"))
.listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_1);
assertThat(result).isNotNull();
}

View File

@ -67,13 +67,12 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTotalNumbersOfClassificationReport() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
@ -131,18 +130,17 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetClassificationReportWithReportLineItemDefinitions() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -200,13 +198,12 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTotalNumbersOfDetailedClassificationReport() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
@ -267,17 +264,16 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetDetailedClassificationReportWithReportLineItemDefinitions() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<DetailedMonitorQueryItem> expectedResult = new ArrayList<>();
DetailedMonitorQueryItem detailedMonitorQueryItem = new DetailedMonitorQueryItem();
@ -342,23 +338,20 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTaskIdsForSelectedItems() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("EXTERN", null, 1, 5));
final List<SelectedItem> selectedItems = List.of(new SelectedItem("EXTERN", null, 1, 5));
final List<String> expectedResult =
Collections.singletonList("TKI:000000000000000000000000000000000001");
final List<String> expectedResult = List.of("TKI:000000000000000000000000000000000001");
when(monitorMapperMock.getTaskIdsForSelectedItems(
workbasketIds,
states,
@ -414,30 +407,28 @@ class ClassificationReportBuilderImplTest {
@Test
void testGetTaskIdsForSelectedItemsIsEmptyResult() throws Exception {
List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("GIBTSNED", null, 0, 0));
List<SelectedItem> selectedItems = List.of(new SelectedItem("GIBTSNED", null, 0, 0));
List<String> 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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
final List<String> expectedResult = List.of("Geschaeftsstelle A");
when(monitorMapperMock.getCustomAttributeValuesForReport(
workbasketIds,
states,
@ -482,7 +473,7 @@ class ClassificationReportBuilderImplTest {
void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws Exception {
List<String> result =
cut.createClassificationReportBuilder()
.workbasketIdIn(Collections.singletonList("DieGibtsGarantiertNed"))
.workbasketIdIn(List.of("DieGibtsGarantiertNed"))
.listCustomAttributeValuesForCustomAttributeName(TaskCustomField.CUSTOM_10);
assertThat(result).isNotNull();
}

View File

@ -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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
@ -110,17 +108,16 @@ class TaskCustomFieldValueReportBuilderImplTest {
@Test
void testGetCustomFieldValueReportWithReportLineItemDefinitions() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -174,19 +171,18 @@ class TaskCustomFieldValueReportBuilderImplTest {
@Test
void testListCustomAttributeValuesForCustomAttributeName() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
List<String> expectedResult = List.of("Geschaeftsstelle A");
when(monitorMapperMock.getCustomAttributeValuesForReport(
workbasketIds,
states,

View File

@ -55,17 +55,16 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetTotalNumbersOfWorkbasketReportBasedOnDueDate() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<CombinedClassificationFilter> combinedClassificationFilter =
Collections.singletonList(
List.of(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000003",
"CLI:000000000000000000000000000000000008"));
@ -119,22 +118,21 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetWorkbasketReportWithReportLineItemDefinitions() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<CombinedClassificationFilter> combinedClassificationFilter =
Collections.singletonList(
List.of(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000003",
"CLI:000000000000000000000000000000000008"));
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
final List<MonitorQueryItem> expectedResult = new ArrayList<>();
MonitorQueryItem monitorQueryItem = new MonitorQueryItem();
@ -188,23 +186,20 @@ class WorkbasketReportBuilderImplTest {
@Test
void testGetTaskIdsOfCategoryReportForSelectedItems() throws Exception {
final List<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
List<SelectedItem> selectedItems =
Collections.singletonList(new SelectedItem("EXTERN", null, 1, 5));
List<SelectedItem> selectedItems = List.of(new SelectedItem("EXTERN", null, 1, 5));
List<String> expectedResult =
Collections.singletonList("TKI:000000000000000000000000000000000001");
List<String> expectedResult = List.of("TKI:000000000000000000000000000000000001");
when(monitorMapperMock.getTaskIdsForSelectedItems(
workbasketIds,
states,
@ -265,7 +260,7 @@ class WorkbasketReportBuilderImplTest {
() -> {
List<String> 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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<TimeIntervalColumnHeader> columnHeaders =
Collections.singletonList(new TimeIntervalColumnHeader(0, 0));
List.of(new TimeIntervalColumnHeader(0, 0));
List<String> expectedResult = Collections.singletonList("Geschaeftsstelle A");
List<String> expectedResult = List.of("Geschaeftsstelle A");
when(monitorMapperMock.getCustomAttributeValuesForReport(
workbasketIds,
states,
@ -330,24 +324,23 @@ class WorkbasketReportBuilderImplTest {
void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws Exception {
List<String> 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<String> workbasketIds =
Collections.singletonList("WBI:000000000000000000000000000000000001");
final List<String> workbasketIds = List.of("WBI:000000000000000000000000000000000001");
final List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
final List<String> categories = Collections.singletonList("EXTERN");
final List<String> domains = Collections.singletonList("DOMAIN_A");
final List<String> classificationIds = Collections.singletonList("L10000");
final List<String> excludedClassificationIds = Collections.singletonList("L20000");
final List<String> categories = List.of("EXTERN");
final List<String> domains = List.of("DOMAIN_A");
final List<String> classificationIds = List.of("L10000");
final List<String> excludedClassificationIds = List.of("L20000");
Map<TaskCustomField, String> customAttributeFilter = new HashMap<>();
customAttributeFilter.put(TaskCustomField.CUSTOM_1, "Geschaeftsstelle A");
final List<CombinedClassificationFilter> combinedClassificationFilter =
Collections.singletonList(
List.of(
new CombinedClassificationFilter(
"CLI:000000000000000000000000000000000003",
"CLI:000000000000000000000000000000000008"));

View File

@ -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<String> newDistTargets = Collections.singletonList(workbasket3.getId());
List<String> newDistTargets = List.of(workbasket3.getId());
Thread.sleep(SLEEP_TIME);
workBasketService.setDistributionTargets(workbasket2.getId(), newDistTargets);

View File

@ -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<String> newDistTargets = Collections.singletonList(workbasket3.getId());
List<String> newDistTargets = List.of(workbasket3.getId());
Thread.sleep(SLEEP_TIME);
workBasketService.setDistributionTargets(workbasket2.getId(), newDistTargets);

View File

@ -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<String> destinations = Collections.singletonList(otherWorkbasketId);
List<String> destinations = List.of(otherWorkbasketId);
workbasketServiceSpy.createWorkbasket(expectedWb);
doReturn(expectedWb).when(workbasketServiceSpy).getWorkbasket(eq(expectedWb.getId()));

View File

@ -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<ClassificationRepresentationModel> clList =
new TaskanaPagedModel<>(
TaskanaPagedModelKeys.CLASSIFICATIONS, Collections.singletonList(classification));
new TaskanaPagedModel<>(TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(classification));
ResponseEntity<Void> 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<ClassificationRepresentationModel> 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<ClassificationRepresentationModel> 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<ClassificationRepresentationModel> 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<ClassificationRepresentationModel> clList =
new TaskanaPagedModel<>(
TaskanaPagedModelKeys.CLASSIFICATIONS,
Collections.singletonList(existingClassification));
TaskanaPagedModelKeys.CLASSIFICATIONS, List.of(existingClassification));
ResponseEntity<Void> 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);

View File

@ -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<String, String> 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<String, String> map = new LinkedMultiValueMap<>();
String key = "unknown";
List<String> value = Collections.singletonList("sort-by");
List<String> 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<String, String> 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<String, String> 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<String> test =
desc -> {
MultiValueMap<String, String> 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<String, String> 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<String, String> 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<String, String> 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))

View File

@ -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);
}

View File

@ -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");

View File

@ -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);