Skip to content

Using AssertJ assertions on entire exercises #2147

Description

@thethoughtcode

The test classes use mix of Junit asserts and AssertJ. Since AssertJ assertions are more robust and extensive as compared to Junit5.

Like for example, usage of assertThatExceptionOfType from AssertJ is much more readable as compare to assertThrows from JUnit 5.

assertThatExceptionOfType(RuntimeException.class)
         .isThrownBy(() -> { throw new RuntimeException(new IllegalArgumentException("boom!")); })
         .havingCause()
         .withMessage("boom!");

We can migrate all the asserts from Junit to AsserJ.

Working on this issue

This issue affects several exercises. If you want to contribute to this issue, you don't have to change this in all exercises, feel free to submit small PRs fixing this issue for a single exercise or a small subset of exercises!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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