Skip to content

When migrating from JUnit to AssertJ, rely on context to provide better assertions #387

Description

@rahulsom

What problem are you trying to solve?

I'm converting JUnit assertions to AssertJ assertions.

Describe the solution you'd like

In the example here - https://docs.openrewrite.org/recipes/java/testing/assertj/junitasserttruetoassertthat

assertTrue(notification() != null && notification() > 0);

is turned into

assertThat(notification() != null && notification() > 0).isTrue();

The more useful conversion would be

assertThat(notification()).isNotNull().isGreaterThan(0)

Have you considered any alternatives or workarounds?

N/A

Additional context

Are you interested in contributing this feature to OpenRewrite?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions