diff --git a/src/test/java/org/kiwiproject/collect/KiwiListsTest.java b/src/test/java/org/kiwiproject/collect/KiwiListsTest.java index 2f1de3c4..d5b6a526 100644 --- a/src/test/java/org/kiwiproject/collect/KiwiListsTest.java +++ b/src/test/java/org/kiwiproject/collect/KiwiListsTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.collect; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -121,7 +120,7 @@ void shouldThrow_WhenNullList() { @Test void shouldReturnSortedList_WhenHasItems() { - var someIntegers = IntStream.iterate(1, n -> n + 1).limit(100).boxed().collect(toList()); + var someIntegers = IntStream.iterate(1, n -> n + 1).limit(100).boxed().toList(); var randomIntegers = newArrayList(someIntegers); Collections.shuffle(randomIntegers); @@ -159,7 +158,7 @@ void shouldThrow_WhenNullComparator() { @Test void shouldReturnSortedList_WhenHasItems() { - var someIntegers = IntStream.iterate(1, n -> n + 1).limit(100).boxed().collect(toList()); + var someIntegers = IntStream.iterate(1, n -> n + 1).limit(100).boxed().toList(); var reverseIntegers = newArrayList(someIntegers); Collections.reverse(reverseIntegers); diff --git a/src/test/java/org/kiwiproject/collect/KiwiMapsTest.java b/src/test/java/org/kiwiproject/collect/KiwiMapsTest.java index 289995f3..7434d976 100644 --- a/src/test/java/org/kiwiproject/collect/KiwiMapsTest.java +++ b/src/test/java/org/kiwiproject/collect/KiwiMapsTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.collect; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; @@ -100,7 +99,7 @@ void testNewLinkedHashMap() { List expectedKeys = Arrays.stream(items) .filter(obj -> obj instanceof String) .map(String.class::cast) - .collect(toList()); + .toList(); assertThat(linkedHashMap.keySet()).containsExactlyElementsOf(expectedKeys); } @@ -127,7 +126,7 @@ void testNewTreeMap() { .filter(obj -> obj instanceof String) .map(String.class::cast) .sorted() - .collect(toList()); + .toList(); assertThat(treeMap.keySet()).containsExactlyElementsOf(expectedKeys); } @@ -147,7 +146,7 @@ void testNewTreeMap_StringKeys_To_ObjectValues() { List transformed = treeMap.entrySet() .stream() .map(entry -> entry.getKey() + entry.getValue()) - .collect(toList()); + .toList(); assertThat(transformed).containsExactly("bar84", "baz126", "foo42"); } @@ -313,7 +312,7 @@ void shouldCreateUnmodifiableLinkedHashMap() { List expectedKeys = Arrays.stream(items) .filter(obj -> obj instanceof String) .map(String.class::cast) - .collect(toList()); + .toList(); assertThat(unmodifiableLinkedHashMap.keySet()).containsExactlyElementsOf(expectedKeys); //noinspection DataFlowIssue @@ -343,7 +342,7 @@ void shouldCreateUnmodifiableTreeMap() { .filter(obj -> obj instanceof String) .map(String.class::cast) .sorted() - .collect(toList()); + .toList(); assertThat(unmodifiableTreeMap.keySet()).containsExactlyElementsOf(expectedKeys); //noinspection DataFlowIssue diff --git a/src/test/java/org/kiwiproject/config/EndpointConfigurationTest.java b/src/test/java/org/kiwiproject/config/EndpointConfigurationTest.java index b313d244..7d74eb21 100644 --- a/src/test/java/org/kiwiproject/config/EndpointConfigurationTest.java +++ b/src/test/java/org/kiwiproject/config/EndpointConfigurationTest.java @@ -1,7 +1,6 @@ package org.kiwiproject.config; import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.fail; @@ -233,7 +232,7 @@ void shouldRoundRobinManyDomains() { var domainNumbers = Stream.iterate(1, value -> value + 1) .limit(numberOfDomains) - .collect(toList()); + .toList(); var cyclingIterable = Iterables.cycle(domainNumbers); StreamSupport.stream(cyclingIterable.spliterator(), /* parallel */ false) diff --git a/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java b/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java index d95b8a5d..9191ad0c 100644 --- a/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java +++ b/src/test/java/org/kiwiproject/config/SecureEndpointsConfigurationTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.config; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.tuple; @@ -330,7 +329,7 @@ private SecureEndpointsConfiguration newSecureEndpointsConfigurationWithEndpoint } private SecureEndpointsConfiguration newSecureEndpointsConfiguration(IntStream tagStream) { - var endpointConfigs = tagStream.mapToObj(this::newHttpEndpointConfiguration).collect(toList()); + var endpointConfigs = tagStream.mapToObj(this::newHttpEndpointConfiguration).toList(); var config = newSecureEndpointsConfigurationWithNoEndpoints(); config.setEndpoints(endpointConfigs); diff --git a/src/test/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3BuildersTest.java b/src/test/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3BuildersTest.java index dd5e948d..12095a98 100644 --- a/src/test/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3BuildersTest.java +++ b/src/test/java/org/kiwiproject/dropwizard/jdbi3/Jdbi3BuildersTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.dropwizard.jdbi3; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.kiwiproject.collect.KiwiLists.first; @@ -125,7 +124,7 @@ private void verifyAndAssertWhenBuildingManagedDataSource(String healthCheckName .map(lifeCycle -> (JettyManaged) lifeCycle) .map(JettyManaged::getManaged) .map(Managed::getClass) - .collect(toList()); + .toList(); assertThat(managedClasses).hasSize(1); var firstManagedClass = first(managedClasses); assertThat(firstManagedClass.getInterfaces()).contains(ManagedDataSource.class); @@ -243,7 +242,7 @@ private void verifyAndAssertWhenGivenAManagedDataSource(ManagedDataSource manage .stream() .map(lifeCycle -> (JettyManaged) lifeCycle) .map(JettyManaged::getManaged) - .collect(toList()); + .toList(); assertThat(managedObjects).containsExactly(managedDataSource); assertThat(healthCheckRegistry.getHealthCheck(healthCheckName)).isInstanceOf(JdbiHealthCheck.class); diff --git a/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTest.java b/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTest.java index 8a8c8cfa..72ab5efb 100644 --- a/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTest.java +++ b/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTest.java @@ -1,7 +1,6 @@ package org.kiwiproject.io; import static java.util.Collections.emptyList; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -333,7 +332,7 @@ void testUpdateFileDeletionMetadata_WhenExceedInMemoryDeleteErrorCapacity() { var filesNotDeleted = IntStream.rangeClosed(1, 501) .mapToObj(value -> newFailedFileDeleteResult(temporaryPath.resolve("folder" + value).toString())) - .collect(toList()); + .toList(); cleaner.updateFileDeletionMetadata(600, filesNotDeleted); diff --git a/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTestHelper.java b/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTestHelper.java index a26cec9a..e10d296a 100644 --- a/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTestHelper.java +++ b/src/test/java/org/kiwiproject/io/TimeBasedDirectoryCleanerTestHelper.java @@ -1,7 +1,5 @@ package org.kiwiproject.io; -import static java.util.stream.Collectors.toList; - import org.apache.commons.io.FileUtils; import java.io.File; @@ -51,7 +49,7 @@ private void newFileInFolder(Path folder, int value) { public List filesInTempFolder() throws IOException { try (var paths = Files.list(cleanerPath)) { - return paths.map(Path::toFile).collect(toList()); + return paths.map(Path::toFile).toList(); } } } diff --git a/src/test/java/org/kiwiproject/jaxrs/KiwiGenericTypesTest.java b/src/test/java/org/kiwiproject/jaxrs/KiwiGenericTypesTest.java index 66f2ff6c..70a531f9 100644 --- a/src/test/java/org/kiwiproject/jaxrs/KiwiGenericTypesTest.java +++ b/src/test/java/org/kiwiproject/jaxrs/KiwiGenericTypesTest.java @@ -1,7 +1,6 @@ package org.kiwiproject.jaxrs; import static java.util.Comparator.comparing; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.kiwiproject.collect.KiwiLists.third; @@ -112,7 +111,7 @@ void shouldSupportListOfStringObjectMaps() { var sortedCars = cars.stream() .sorted(comparing(car -> car.get("model").toString())) - .collect(toList()); + .toList(); assertThat(sortedCars).hasSize(3); diff --git a/src/test/java/org/kiwiproject/regex/MatchSpliteratorTest.java b/src/test/java/org/kiwiproject/regex/MatchSpliteratorTest.java index 7b3824db..038e7b80 100644 --- a/src/test/java/org/kiwiproject/regex/MatchSpliteratorTest.java +++ b/src/test/java/org/kiwiproject/regex/MatchSpliteratorTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.regex; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.tuple; @@ -49,7 +48,7 @@ void shouldCreateMatchResultStream() { var matcher = Pattern.compile("the|(lazy cat)", Pattern.CASE_INSENSITIVE).matcher(input); var matchSpliterator = new MatchSpliterator(matcher); - var matchResults = matchSpliterator.stream().collect(toList()); + var matchResults = matchSpliterator.stream().toList(); assertThat(matchResults) .extracting(MatchResult::group, MatchResult::start) .containsExactly( @@ -66,7 +65,7 @@ class StreamFromRegex { @Test void shouldCreateMatchResultStream_FromStringRegularExpression() { var input = "The quick brown fox jumped over the fence and the lazy brown dog"; - var matchResults = MatchSpliterator.stream("the", input).collect(toList()); + var matchResults = MatchSpliterator.stream("the", input).toList(); assertThat(matchResults) .extracting(MatchResult::group, MatchResult::start) @@ -91,7 +90,7 @@ class StreamFromPattern { void shouldCreateMatchResultStream_FromPattern() { var input = "The quick brown fox jumped over the fence and the lazy brown dog and the lazy cat"; var pattern = Pattern.compile("the|(lazy cat)", Pattern.CASE_INSENSITIVE); - var matchResults = MatchSpliterator.stream(pattern, input).collect(toList()); + var matchResults = MatchSpliterator.stream(pattern, input).toList(); assertThat(matchResults) .extracting(MatchResult::group, MatchResult::start) diff --git a/src/test/java/org/kiwiproject/retry/InMemoryAppender.java b/src/test/java/org/kiwiproject/retry/InMemoryAppender.java index 6bebb66c..6774479c 100644 --- a/src/test/java/org/kiwiproject/retry/InMemoryAppender.java +++ b/src/test/java/org/kiwiproject/retry/InMemoryAppender.java @@ -1,7 +1,6 @@ package org.kiwiproject.retry; import static java.util.Comparator.comparing; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import ch.qos.logback.classic.spi.ILoggingEvent; @@ -49,13 +48,13 @@ synchronized void clearEvents() { } List getOrderedEvents() { - return getOrderedEventStream().collect(toList()); + return getOrderedEventStream().toList(); } List getOrderedEventMessages() { return getOrderedEventStream() .map(ILoggingEvent::getFormattedMessage) - .collect(toList()); + .toList(); } private Stream getOrderedEventStream() { diff --git a/src/test/java/org/kiwiproject/spring/data/AbstractPagingQueryIntegrationTest.java b/src/test/java/org/kiwiproject/spring/data/AbstractPagingQueryIntegrationTest.java index f71ed53d..54ea4393 100644 --- a/src/test/java/org/kiwiproject/spring/data/AbstractPagingQueryIntegrationTest.java +++ b/src/test/java/org/kiwiproject/spring/data/AbstractPagingQueryIntegrationTest.java @@ -2,7 +2,6 @@ import static java.util.Comparator.comparing; import static java.util.Comparator.comparingDouble; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.kiwiproject.base.KiwiStrings.f; import static org.kiwiproject.spring.data.OrderTestData.ORDER_COLLECTION; @@ -119,12 +118,12 @@ void shouldAggregatePage(SoftAssertions softly) { .sorted(comparing(Order::getCustomerId)) .map(Order::getCustomerId) .limit(limit) - .collect(toList()); + .toList(); var aggregatedCustomerIds = aggregatePage.getContent() .stream() .map(Order::getCustomerId) - .collect(toList()); + .toList(); softly.assertThat(aggregatedCustomerIds).isEqualTo(expectedCustomerIds); } @@ -202,7 +201,7 @@ void shouldAggregatePage_WithMatchOperation(SoftAssertions softly) { .filter(orderFilter) .sorted(comparing(Order::getCustomerId).thenComparing(comparingDouble(Order::getAmount).reversed())) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(aggregatePage.getContent()).isEqualTo(expectedOrders); } diff --git a/src/test/java/org/kiwiproject/spring/data/KiwiMongoIndexesTest.java b/src/test/java/org/kiwiproject/spring/data/KiwiMongoIndexesTest.java index c4b0b0c2..f9eda788 100644 --- a/src/test/java/org/kiwiproject/spring/data/KiwiMongoIndexesTest.java +++ b/src/test/java/org/kiwiproject/spring/data/KiwiMongoIndexesTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.spring.data; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; import static org.kiwiproject.spring.util.MongoTestHelpers.newMongoTemplate; @@ -69,7 +68,7 @@ private void assertIndices(Sort.Direction direction) { var indexFields = indexInfos.stream() .map(IndexInfo::getIndexFields) .flatMap(Collection::stream) - .collect(toList()); + .toList(); assertThat(indexFields) .extracting("key", "direction") diff --git a/src/test/java/org/kiwiproject/spring/data/KiwiPagingTest.java b/src/test/java/org/kiwiproject/spring/data/KiwiPagingTest.java index 0834cd36..c56f976f 100644 --- a/src/test/java/org/kiwiproject/spring/data/KiwiPagingTest.java +++ b/src/test/java/org/kiwiproject/spring/data/KiwiPagingTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.spring.data; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -337,7 +336,7 @@ private static List createTestSortDirectionFieldPairList() { private static void assertSortChain(Sort sortChain) { assertThat(sortChain).isNotNull(); - var sortOrders = Streams.stream(sortChain.iterator()).collect(toList()); + var sortOrders = Streams.stream(sortChain.iterator()).toList(); assertThat(sortOrders) .extracting("property", "direction") diff --git a/src/test/java/org/kiwiproject/spring/data/KiwiSpringMongoQueriesTest.java b/src/test/java/org/kiwiproject/spring/data/KiwiSpringMongoQueriesTest.java index 6eac5184..65ba878b 100644 --- a/src/test/java/org/kiwiproject/spring/data/KiwiSpringMongoQueriesTest.java +++ b/src/test/java/org/kiwiproject/spring/data/KiwiSpringMongoQueriesTest.java @@ -2,7 +2,6 @@ import static java.util.Comparator.comparing; import static java.util.Comparator.comparingDouble; -import static java.util.stream.Collectors.toList; import static org.apache.commons.lang3.StringUtils.containsAny; import static org.assertj.core.api.Assertions.assertThat; import static org.kiwiproject.collect.KiwiLists.first; @@ -117,7 +116,7 @@ void shouldPaginate_WithAscendingSort(SoftAssertions softly) { var expectedOrders = storedOrders.stream() .sorted(comparing(Order::getCustomerId)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -148,7 +147,7 @@ void shouldPaginate_WithPrimaryAndSecondarySort(SoftAssertions softly) { var expectedOrders = storedOrders.stream() .sorted(comparing(Order::getCustomerId).thenComparing(comparingDouble(Order::getAmount).reversed())) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -176,7 +175,7 @@ void shouldPaginate_WithDescendingSort(SoftAssertions softly) { var expectedOrders = storedOrders.stream() .sorted(comparing(Order::getCustomerId).reversed()) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -208,7 +207,7 @@ void shouldPaginate_GettingSecondPage(SoftAssertions softly) { .sorted(comparing(Order::getCustomerId).thenComparing(Order::getStatus)) .skip(pageNumber * limit) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -280,7 +279,7 @@ void shouldAllowAddingCriteria(SoftAssertions softly) { .filter(order -> order.getCustomerId().equals("A123")) .sorted(comparing(Order::getAmount).reversed()) .limit(limit) - .collect(toList()); + .toList(); var expectedTotalElements = expectedOrders.size(); @@ -326,7 +325,7 @@ void shouldAddDateBounds(SoftAssertions softly) { order.getDateReceived().toInstant().isAfter(startDate) && order.getDateReceived().toInstant().isBefore(endDate)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -450,7 +449,7 @@ void shouldAddPartialOrEqualMatchCriteria_WithPartialMatch(SoftAssertions softly .filter(customerFilter) .sorted(comparing(Order::getCustomerId)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -487,7 +486,7 @@ void shouldAddPartialOrEqualMatchCriteria_WithEqualMatch(SoftAssertions softly) .filter(customerFilter) .sorted(comparing(Order::getCustomerId)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -538,7 +537,7 @@ void shouldAddMultiplePartialOrEqualMatchCriteria_WithPartialMatch(SoftAssertion .filter(customerFilter) .sorted(comparing(Order::getCustomerId)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -576,7 +575,7 @@ void shouldAddMultiplePartialOrEqualMatchCriteria_WithEqualMatch(SoftAssertions .filter(customerFilter) .sorted(comparing(Order::getCustomerId)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -625,7 +624,7 @@ void shouldAddInCriteriaFromCsv(SoftAssertions softly) { .filter(customerFilter) .sorted(comparing(Order::getCustomerId)) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } @@ -665,7 +664,7 @@ void shouldAddInCriteriaFromCsv_WithTypeConverter(SoftAssertions softly) { .filter(amountFilter) .sorted(comparing(Order::getCustomerId).thenComparing(comparingDouble(Order::getAmount).reversed())) .limit(limit) - .collect(toList()); + .toList(); softly.assertThat(orderPage.getContent()).isEqualTo(expectedOrders); } diff --git a/src/test/java/org/kiwiproject/spring/data/OrderTestData.java b/src/test/java/org/kiwiproject/spring/data/OrderTestData.java index 45435472..1843c5db 100644 --- a/src/test/java/org/kiwiproject/spring/data/OrderTestData.java +++ b/src/test/java/org/kiwiproject/spring/data/OrderTestData.java @@ -1,7 +1,5 @@ package org.kiwiproject.spring.data; -import static java.util.stream.Collectors.toList; - import lombok.AllArgsConstructor; import org.kiwiproject.time.KiwiInstants; import org.springframework.data.mongodb.core.MongoTemplate; @@ -48,6 +46,6 @@ public static List insertSampleOrders(MongoTemplate mongoTemplate) { return orders.stream() .map(mongoTemplate::insert) - .collect(toList()); + .toList(); } } diff --git a/src/test/java/org/kiwiproject/stream/IntStreamsTest.java b/src/test/java/org/kiwiproject/stream/IntStreamsTest.java index eb2fb52b..74cddf72 100644 --- a/src/test/java/org/kiwiproject/stream/IntStreamsTest.java +++ b/src/test/java/org/kiwiproject/stream/IntStreamsTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.stream; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.DisplayName; @@ -18,7 +17,7 @@ class IndicesOf { @Test void shouldReturnEmptyStringWhenGivenEmptyList() { var stream = IntStreams.indicesOf(List.of()); - var indices = stream.boxed().collect(toList()); + var indices = stream.boxed().toList(); assertThat(indices).isEmpty(); } @@ -28,7 +27,7 @@ void shouldReturnIndices() { var strings = List.of("a", "b", "c", "d"); var stream = IntStreams.indicesOf(strings); - var indices = stream.boxed().collect(toList()); + var indices = stream.boxed().toList(); assertThat(indices).containsExactly(0, 1, 2, 3); } diff --git a/src/test/java/org/kiwiproject/util/regex/KiwiRegexesTest.java b/src/test/java/org/kiwiproject/util/regex/KiwiRegexesTest.java index 6a37f6a5..5b898c09 100644 --- a/src/test/java/org/kiwiproject/util/regex/KiwiRegexesTest.java +++ b/src/test/java/org/kiwiproject/util/regex/KiwiRegexesTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.util.regex; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -113,7 +112,7 @@ void shouldReturnStream_ContainingMatches() { var matchResultStream = KiwiRegexes.extractMatches(pattern, input); var matches = matchResultStream .map(MatchResult::group) - .collect(toList()); + .toList(); assertThat(matches).containsExactly("red fox", "lazy brown"); } @@ -123,7 +122,7 @@ void shouldReturnEmptyStream_WhenThereAreNoMatches() { var pattern = Pattern.compile("(blue|orange|purple|lazy violet)", Pattern.MULTILINE); - var matchResults = KiwiRegexes.extractMatches(pattern, input).collect(toList()); + var matchResults = KiwiRegexes.extractMatches(pattern, input).toList(); assertThat(matchResults).isEmpty(); } diff --git a/src/test/java/org/kiwiproject/validation/InEnumValidatorTest.java b/src/test/java/org/kiwiproject/validation/InEnumValidatorTest.java index 35836965..f3c59a84 100644 --- a/src/test/java/org/kiwiproject/validation/InEnumValidatorTest.java +++ b/src/test/java/org/kiwiproject/validation/InEnumValidatorTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.validation; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; import static org.kiwiproject.base.KiwiStrings.f; @@ -153,7 +152,7 @@ String exceptionalReadableValue() { } static List readableValues() { - return Arrays.stream(values()).map(Season::readableValue).collect(toList()); + return Arrays.stream(values()).map(Season::readableValue).toList(); } } diff --git a/src/test/java/org/kiwiproject/validation/KiwiConstraintViolationsTest.java b/src/test/java/org/kiwiproject/validation/KiwiConstraintViolationsTest.java index b9415b70..a28187c3 100644 --- a/src/test/java/org/kiwiproject/validation/KiwiConstraintViolationsTest.java +++ b/src/test/java/org/kiwiproject/validation/KiwiConstraintViolationsTest.java @@ -1,6 +1,5 @@ package org.kiwiproject.validation; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.entry; @@ -476,7 +475,7 @@ void shouldBuildMap() { var emailViolation = firstViolation(bob, "contactInfo.email.address"); var nameViolations = validator.validateProperty(bob, "fullName").stream() .map(ConstraintViolation::getMessage) - .collect(toList()); + .toList(); var violations = validator.validate(bob);