Skip to content

Commit

Permalink
refactor: OpenRewrite best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne committed Apr 9, 2024
1 parent 1f73058 commit 52f6e22
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 @@ -116,12 +116,12 @@ public G.CompilationUnit visitCompilationUnit(G.CompilationUnit t, ExecutionCont
private static class AddJupiterMaven extends MavenIsoVisitor<ExecutionContext> {
AddDependency.Accumulator acc;
@Override
public Xml.Document visitDocument(Xml.Document document, ExecutionContext executionContext) {
public Xml.Document visitDocument(Xml.Document document, ExecutionContext ctx) {
Xml.Document d = document;
List<ResolvedDependency> jupiterApi = getResolutionResult().findDependencies("org.junit.jupiter", "junit-jupiter-api", Scope.Test);
if(jupiterApi.isEmpty()) {
d = (Xml.Document) addJupiterDependency().getVisitor(acc)
.visitNonNull(d, executionContext);
.visitNonNull(d, ctx);
}
return d;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ void noJunitDependencyIfApiAlreadyPresent() {
rewriteRun(
spec -> spec.beforeRecipe(withToolingApi()),
//language=groovy
buildGradle("""
buildGradle(
"""
plugins {
id 'java-library'
}
Expand All @@ -355,7 +356,8 @@ void noJunitDependencyIfApiAlreadyPresent() {
}
"""),
//language=xml
pomXml("""
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>dev.ted</groupId>
Expand Down

0 comments on commit 52f6e22

Please sign in to comment.