+1

We use it a lot in the current project and I started a special module for
JSR 363 for AssertJ in
https://github.com/unitsofmeasurement/uom-lib/tree/master/assertj.

assertTrue(collection.size() == 1) is clearly an antipattern. At the very
least one should have used
assertEquals(1, collection.size(), 0) instead, so if it fails you get a
much better description of what failed.
For that AssertJ also offers further comfort, e.g. its own
AssertionExceptions with detailed information or messages you can override.
Also using that right now e.g. for API smoke tests where it shows exactly
which API call failed and how it deviated from the expected state;-)

Cheers,
Werner


On Thu, Jan 5, 2017 at 10:51 PM, P. Ottlinger <[email protected]> wrote:

> Hi,
>
> does anyone object that we use assertj for mor expressive testing matchers?
>
> I just stumbled upon:
>
>         assertTrue(change.getChanges().size() == 1);
>
> which would be more clear as
> assertThat(change.getChanges()).isNotNull().isNotEmpty().hasSize(1);
>
>
> Any objections if I add assertJ in test-scope?
>
> Cheers,
> Phil
>

Reply via email to