-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Description
This was raised before by @cpovirk #48 and IMO the suggestion that error prone would catch it is irrelevant since truth doesn't require error prone.
Truth is a fluent API so the "contract" is that grammatically correct things would work as expected: "assert that something is true" is correct, yet Truth requires a double boolean check.
This looks natural:
assertThat(e.getStatus().getCode() == Status.ALREADY_EXISTS.getCode());
It's also consistent with how Guava preconditions work, however it's wrong and will always pass.
The correct (boolean) version is not fluent
assertThat(e.getStatus().getCode() == Status.ALREADY_EXISTS.getCode()).isTrue();
// and yes, it should be
assertThat(e.getStatus().getCode()).isEqualTo(Status.ALREADY_EXISTS.getCode());
Worse it's terribly difficult to spot and that's a sign of a bad API.
Metadata
Metadata
Assignees
Labels
No labels