Skip to content

Commit

Permalink
Context free SimplifyAssertJAssertion (#570)
Browse files Browse the repository at this point in the history
* Context free SimplifyAssertJAssertion

* Apply suggestions from code review

Co-authored-by: Knut Wannheden <knut@moderne.io>

---------

Co-authored-by: Knut Wannheden <knut@moderne.io>
  • Loading branch information
timtebeek and knutwannheden authored Aug 12, 2024
1 parent 8a037e8 commit b1e8bf0
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation methodInvocat
}

// Assume zero argument replacement method
return JavaTemplate.builder(dedicatedAssertion + "()")
.contextSensitive()
return JavaTemplate.builder("#{any()}." + dedicatedAssertion + "()")
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(ctx, "assertj-core-3.24"))
.build()
.apply(getCursor(), mi.getCoordinates().replaceMethod());
.apply(getCursor(), mi.getCoordinates().replace(), mi.getSelect());
}
}
}

0 comments on commit b1e8bf0

Please sign in to comment.