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

AssertionsArgumentOrder does not work with Junit 4 assertions #636

Closed
adambir opened this issue Nov 6, 2024 · 1 comment · Fixed by #637
Closed

AssertionsArgumentOrder does not work with Junit 4 assertions #636

adambir opened this issue Nov 6, 2024 · 1 comment · Fixed by #637
Assignees
Labels
bug Something isn't working

Comments

@adambir
Copy link
Contributor

adambir commented Nov 6, 2024

AssertionsArgumentOrder does not work with Junit 4 assertions, even though the main documentation mentions it :

Assertions such as org.junit.Assert.assertEquals expect the first argument to be the expected value and the second argument to be the actual value [...]

What version of OpenRewrite are you using?

I am using

  • Maven/Gradle plugin v5.43.2
  • rewrite-testing-frameworks v2.21.0

How are you running OpenRewrite?

Using the mvn plugin with a multi project module

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

              import static org.junit.Assert.assertEquals;
                          
              class MyTest {
                  void someMethod() {
                      assertEquals(result(), "result");
                      assertEquals(result(), "result", "message");
                      assertEquals(0L, 1L);
                  }
                  String result() {
                      return "result";
                  }
              }

What did you expect to see?

              import static org.junit.Assert.assertEquals;
                          
              class MyTest {
                  void someMethod() {
                      assertEquals("result", result());
                      assertEquals("result", result(), "message");
                      assertEquals(0L, 1L);
                  }
                  String result() {
                      return "result";
                  }
              }

What did you see instead?

```java
              import static org.junit.Assert.assertEquals;
                          
              class MyTest {
                  void someMethod() {
                      assertEquals(result(), "result");
                      assertEquals(result(), "result", "message");
                      assertEquals(0L, 1L);
                  }
                  String result() {
                      return "result";
                  }
              }

Are you interested in contributing a fix to OpenRewrite?

Yes, I'd like to propose a PR to generalize the behaviour to Junit 4. I would first need confirmation that this is something that could be considered.

@adambir adambir added the bug Something isn't working label Nov 6, 2024
@adambir
Copy link
Contributor Author

adambir commented Nov 6, 2024

Added a PR #637

@timtebeek timtebeek moved this to Ready to Review in OpenRewrite Nov 11, 2024
@timtebeek timtebeek moved this from Ready to Review to In Progress in OpenRewrite Nov 11, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant