File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
src/test/java/org/openrewrite/java/migrate/guava Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change 2727class PreferJavaUtilPredicateTest implements RewriteTest {
2828 @ Override
2929 public void defaults (RecipeSpec spec ) {
30- spec .recipeFromResources ("org.openrewrite.java.migrate.guava.PreferJavaUtilPredicate" )
30+ spec .recipeFromResource (
31+ "/META-INF/rewrite/no-guava.yml" ,
32+ "org.openrewrite.java.migrate.guava.PreferJavaUtilPredicate" )
3133 .parser (JavaParser .fromJavaVersion ().classpathFromResources (new InMemoryExecutionContext (), "guava" ));
3234 }
3335
@@ -69,6 +71,34 @@ public boolean test(String input) {
6971 );
7072 }
7173
74+ @ Test
75+ void predicatesNotToPredicate () {
76+ rewriteRun (
77+ //language=java
78+ java (
79+ """
80+ import com.google.common.base.Predicate;
81+ import com.google.common.base.Predicates;
82+ class A {
83+ public static Predicate<String> notEmptyPredicate() {
84+ Predicate<String> isEmpty = String::isEmpty;
85+ return Predicates.not(isEmpty);
86+ }
87+ }
88+ """ ,
89+ """
90+ import java.util.function.Predicate;
91+ class A {
92+ public static Predicate<String> notEmptyPredicate() {
93+ Predicate<String> isEmpty = String::isEmpty;
94+ return Predicate.not(isEmpty);
95+ }
96+ }
97+ """
98+ )
99+ );
100+ }
101+
72102 @ Test
73103 void predicatesEqualToToPredicateIsEqual () {
74104 rewriteRun (
You can’t perform that action at this time.
0 commit comments