Skip to content

Discussion: Switch the order of 'actual' and 'expected' in Assertions APIs #623

@mkobit

Description

@mkobit

One of the things that I find unnatural is the ordering in JUnit 4 assertions. They mostly all follow the assert(expected, actual) format. Hamcrest assertions have the reverse with actual, expected which has a more natural flow when reading the code (my opinion) and results in more fluent assertions. The Assertions class in the Jupiter API continues with the JUnit 4 style of expected, actual.

Most newer assertion frameworks now seem to follow the notion of putting the "actual", so I think it would be a good idea to follow that paradigm with JUnit 5 over using the existing assertion ordering that is present in JUnit 4.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions