Open timtebeek opened 1 year ago
Once merged we can run this against spring-security, as seen previously in https://github.com/spring-projects/spring-security/pull/13619
Seeing some errors when run against Spring Security; would you mind investigating @AlekSimpson ?
assertThat(returned).as("The returned value is not correct.").isEqualTo(Tag.EVAL_PAGE)
class org.openrewrite.java.tree.J$Identifier cannot be cast to class org.openrewrite.java.tree.J$MethodInvocation (org.openrewrite.java.tree.J$Identifier and org.openrewrite.java.tree.J$MethodInvocation are in unnamed module of loader 'app')
java.lang.ClassCastException: class org.openrewrite.java.tree.J$Identifier cannot be cast to class org.openrewrite.java.tree.J$MethodInvocation (org.openrewrite.java.tree.J$Identifier and org.openrewrite.java.tree.J$MethodInvocation are in unnamed module of loader 'app')
org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions$AdoptAssertJDurationAssertionsVisitor.simplifyMultipleAssertions(AdoptAssertJDurationAssertions.java:132)
org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions$AdoptAssertJDurationAssertionsVisitor.visitMethodInvocation(AdoptAssertJDurationAssertions.java:110)
org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions$AdoptAssertJDurationAssertionsVisitor.visitMethodInvocation(AdoptAssertJDurationAssertions.java:73)
org.openrewrite.java.tree.J$MethodInvocation.acceptJava(J.java:3723)
org.openrewrite.java.tree.J.accept(J.java:59)
org.openrewrite.TreeVisitor.visit(TreeVisitor.java:278)
org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:361)
org.openrewrite.java.JavaVisitor.visitRightPadded(JavaVisitor.java:1299)
...
assertThat(chain.length).as("Unexpected chain size").isEqualTo(1)
class org.openrewrite.java.tree.J$FieldAccess cannot be cast to class org.openrewrite.java.tree.J$MethodInvocation (org.openrewrite.java.tree.J$FieldAccess and org.openrewrite.java.tree.J$MethodInvocation are in unnamed module of loader 'app')
java.lang.ClassCastException: class org.openrewrite.java.tree.J$FieldAccess cannot be cast to class org.openrewrite.java.tree.J$MethodInvocation (org.openrewrite.java.tree.J$FieldAccess and org.openrewrite.java.tree.J$MethodInvocation are in unnamed module of loader 'app')
org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions$AdoptAssertJDurationAssertionsVisitor.simplifyMultipleAssertions(AdoptAssertJDurationAssertions.java:132)
org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions$AdoptAssertJDurationAssertionsVisitor.visitMethodInvocation(AdoptAssertJDurationAssertions.java:110)
org.openrewrite.java.testing.assertj.AdoptAssertJDurationAssertions$AdoptAssertJDurationAssertionsVisitor.visitMethodInvocation(AdoptAssertJDurationAssertions.java:73)
org.openrewrite.java.tree.J$MethodInvocation.acceptJava(J.java:3723)
org.openrewrite.java.tree.J.accept(J.java:59)
org.openrewrite.TreeVisitor.visit(TreeVisitor.java:278)
org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:361)
org.openrewrite.java.JavaVisitor.visitRightPadded(JavaVisitor.java:1299)
...
Now the recipes don't seem to make any changes on spring-security, although I'm fairly certain there's some improvements to be made still.
What problem are you trying to solve?
More expressive assertions around durations, using the methods defined in: https://www.javadoc.io/static/org.assertj/assertj-core/3.24.2/org/assertj/core/api/DurationAssert.html
What precondition(s) should be checked before applying this recipe?
Durations are used in the class.
Describe the situation before applying the recipe
Describe the situation after applying the recipe
Any additional context
We might also want to simplify the durations of the resulting assertions, similar to what we already do in: https://docs.openrewrite.org/recipes/staticanalysis/simplifydurationcreationunits