Skip to content

Commit

Permalink
Use toList() (#1280)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalluck authored Nov 20, 2024
1 parent 0f93d36 commit 4b022b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down Expand Up @@ -115,10 +114,7 @@ void testMapping() throws IOException {
assertThat(bc.getChecksumOnly()).isTrue();
assertThat(bc.getChecksumTypes()).containsExactly(ChecksumType.md5);

List<String> excludes = bc.getExcludes()
.stream()
.map(Pattern::pattern)
.collect(Collectors.toUnmodifiableList());
List<String> excludes = bc.getExcludes().stream().map(Pattern::pattern).toList();

assertThat(excludes).containsExactly(Pattern.compile("^(?!.*/pom\\.xml$).*/.*\\.xml$").pattern());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.collections4.MultiValuedMap;
Expand Down Expand Up @@ -104,7 +103,7 @@ void testType(@TempDir File folder) throws IOException {
@Test
void testCacheClearance(@TempDir File folder) throws IOException {
try (Stream<Path> stream = Files.walk(folder.toPath())) {
Collection<Path> ls = stream.collect(Collectors.toUnmodifiableList());
Collection<Path> ls = stream.toList();
assertThat(ls).hasSize(1);
}

Expand All @@ -115,7 +114,7 @@ void testCacheClearance(@TempDir File folder) throws IOException {
da.checksumFiles();

try (Stream<Path> stream = Files.walk(folder.toPath())) {
Collection<Path> files = stream.collect(Collectors.toUnmodifiableList());
Collection<Path> files = stream.toList();
assertThat(files).hasSize(1);
}
}
Expand Down

0 comments on commit 4b022b5

Please sign in to comment.