Skip to content

Commit 0aad424

Browse files
committed
Minimize irrelevant parts in test method setup
1 parent 4190e42 commit 0aad424

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/main/java/org/openrewrite/java/migrate/guava/NoGuavaSetsFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 the original author or authors.
2+
* Copyright 2025 the original author or authors.
33
* <p>
44
* Licensed under the Moderne Source Available License (the "License");
55
* you may not use this file except in compliance with the License.

src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsFilterTest.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 the original author or authors.
2+
* Copyright 2025 the original author or authors.
33
* <p>
44
* Licensed under the Moderne Source Available License (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,33 +40,25 @@ void replaceSetsFilter() {
4040
rewriteRun(
4141
java(
4242
"""
43-
import java.util.HashSet;
44-
import java.util.Objects;
4543
import java.util.Set;
4644
4745
import com.google.common.base.Predicate;
4846
import com.google.common.collect.Sets;
4947
5048
class Test {
51-
public static Set<Object> test() {
52-
Set<Object> set = new HashSet<>();
53-
Predicate<Object> isNotNull = Objects::nonNull;
49+
public static Set<Object> test(Set<Object> set, Predicate<Object> isNotNull) {
5450
return Sets.filter(set, isNotNull);
5551
}
5652
}
5753
""",
5854
"""
59-
import java.util.HashSet;
60-
import java.util.Objects;
6155
import java.util.Set;
6256
import java.util.stream.Collectors;
6357
6458
import com.google.common.base.Predicate;
6559
6660
class Test {
67-
public static Set<Object> test() {
68-
Set<Object> set = new HashSet<>();
69-
Predicate<Object> isNotNull = Objects::nonNull;
61+
public static Set<Object> test(Set<Object> set, Predicate<Object> isNotNull) {
7062
return set.stream().filter(isNotNull).collect(Collectors.toSet());
7163
}
7264
}

0 commit comments

Comments
 (0)