Skip to content

JUnit5's assertInstanceOf is not converted to AssertJ equivalent #607

Description

@timo-abele

What version of OpenRewrite are you using?

I am using the latest version as of 2024-09-21

How are you running OpenRewrite?

originally gradle build file, also verified via PR:

What is the smallest, simplest way to reproduce the problem?

full example: https://github.com/openrewrite/rewrite-testing-frameworks/pull/606/files#diff-bfebe6e8e82e88df037959cc55562fae9a10b6b050dd49036be913fd07f93295R45-R70

assertInstanceOf(Integer.class, 4);

What did you expect to see?

assertThat(4).isInstanceOf(Integer.class);

What did you see instead?

no change

What is the full stack trace of any errors you encountered?

https://github.com/openrewrite/rewrite-testing-frameworks/actions/runs/10971347200/job/30466378864?pr=606#step:5:1500

AssertJBestPracticesTest > convertsIsInstanceOf() FAILED
    java.lang.AssertionError: Recipe was expected to make a change but made no changes.
        at org.openrewrite.test.LargeSourceSetCheckingExpectedCycles.afterCycle(LargeSourceSetCheckingExpectedCycles.java:119)
        at org.openrewrite.RecipeScheduler.runRecipeCycles(RecipeScheduler.java:98)
        at org.openrewrite.RecipeScheduler.scheduleRun(RecipeScheduler.java:41)
        at org.openrewrite.Recipe.run(Recipe.java:376)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:371)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:130)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:125)
        at org.openrewrite.java.testing.assertj.AssertJBestPracticesTest.convertsIsInstanceOf(AssertJBestPracticesTest.java:48)

Are you interested in contributing a fix to OpenRewrite?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertjbugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions