/SomeRecipeTest.java Secret
Created
December 5, 2022 21:00
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.yourorg.starter; | |
import org.junit.jupiter.api.Test; | |
import org.openrewrite.test.RecipeSpec; | |
import org.openrewrite.test.RewriteTest; | |
import static org.openrewrite.java.Assertions.java; | |
public class SomeRecipeTest implements RewriteTest { | |
@Override | |
public void defaults(RecipeSpec spec) { | |
spec.recipe(new SomeRecipe()); | |
} | |
@Test | |
void example() { | |
rewriteRun( | |
//language=java | |
java(""" | |
package org.openrewrite; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
@AnAnnotation | |
public class A { | |
List<Integer> a = new ArrayList<>(); | |
int foo() { | |
int a = 1 + 2, b = 3, c; | |
this.a = this.a.stream() | |
.map(it -> it + 1) | |
.collect(Collectors.toList()); | |
return a; | |
} | |
} | |
@interface AnAnnotation {} | |
""") | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment