Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollapseConsecutiveAssertThatStatements does not work on Integers (possibly only on Lists?) #605

Open
timo-abele opened this issue Sep 21, 2024 · 1 comment
Labels

Comments

@timo-abele
Copy link
Contributor

timo-abele commented Sep 21, 2024

What version of OpenRewrite are you using?

I am using the latest as of 2024-09-20

How are you running OpenRewrite?

Gradle by editing build file, confirmed by tests on this repository:

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

in short:

                      Integer i = 1+1;
                      assertThat(i).isNotNull();
                      assertThat(i).isEqualTo(2);

What did you expect to see?

                      Integer i = 1+1;
                      assertThat(i).isNotNull().isEqualTo(2);

What did you see instead?

no change

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

per https://github.com/openrewrite/rewrite-testing-frameworks/actions/runs/10971127404/job/30465846209?pr=604#step:5:1484

CollapseConsecutiveAssertThatStatementsTest > collapseAssertThatsOnInteger() 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.CollapseConsecutiveAssertThatStatementsTest.collapseAssertThatsOnInteger(CollapseConsecutiveAssertThatStatementsTest.java:197)

Context

The existing test are all on Lists, so maybe the recipe currently only works on those and other types need to be enabled in general.

Are you interested in contributing a fix to OpenRewrite?

No

@timo-abele timo-abele added the bug Something isn't working label Sep 21, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Sep 21, 2024
@timtebeek timtebeek added enhancement New feature or request and removed bug Something isn't working labels Sep 21, 2024
@timtebeek
Copy link
Contributor

A test was already provided in

This might need a new check in the TypeUtils we use to compare whether types are compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

2 participants