Skip to content

JUnit 6: Swap expected and actual parameters for Assertions #4835

@bjmi

Description

@bjmi

The vast majority of Assertion libraries for Java make assertions in the order
actual to expected.

  • AssertJ
  • Hamcrest
  • Truth
  • Atrium
  • TestNG
    (Kotlin: Kotest, kotlinx-assertions, Strikt)

With the introduction of JUnit 6, it would be now possible to incorporating this into JUnit.

When we first introduced assertEquals in JUnit Jupiter, I copied and modified the existing logic from JUnit 4.
There was no rationale other than keeping it similar to JUnit 4.
Ref: #3120 (comment)

Now there is an opportunity to fix this. :)

Refs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions