Skip to content

Commit

Permalink
refactor: OpenRewrite best practices
Browse files Browse the repository at this point in the history
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.recipes.OpenRewriteBestPractices?organizationId=T3BlblJld3JpdGU%3D

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
2 people authored and app committed Mar 21, 2024
1 parent 74ce09f commit db1f919
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu

private static class AddUseJUnitPlatform extends GroovyIsoVisitor<ExecutionContext> {
@Override
public G.CompilationUnit visitCompilationUnit(G.CompilationUnit cu, ExecutionContext executionContext) {
public G.CompilationUnit visitCompilationUnit(G.CompilationUnit cu, ExecutionContext ctx) {
G.CompilationUnit template = GradleParser.builder()
.build()
.parse("plugins {\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@
package org.openrewrite.java.testing.junit5;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.gradle.Assertions.buildGradle;
import static org.openrewrite.gradle.toolingapi.Assertions.withToolingApi;

public class GradleUseJunitJupiterTest implements RewriteTest {
class GradleUseJunitJupiterTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec.recipe(new GradleUseJunitJupiter())
.beforeRecipe(withToolingApi());
}

@DocumentExample
@Test
void addWhenMissing() {
rewriteRun(
Expand Down Expand Up @@ -59,7 +61,7 @@ void addWhenMissing() {
}

@Test
void testDsl() {
void dsl() {
rewriteRun(
//language=groovy
buildGradle(
Expand All @@ -83,7 +85,7 @@ void testDsl() {
}

@Test
void testDslAlreadyExists() {
void dslAlreadyExists() {
rewriteRun(
//language=groovy
buildGradle(
Expand Down

0 comments on commit db1f919

Please sign in to comment.