Skip to content

Instantly share code, notes, and snippets.

@mike-solomon
Created December 5, 2022 21:00
Embed
What would you like to do?
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