Open sul3n3t opened 9 years ago
This also applies to truth assertions.
You can get this for free by adding @CheckReturnValue
annotations to these methods (that's what truth does). But it if the other libraries can't be annotated directly, it would be easy to make a variant of ReturnValueIgnored that caught that error.
Thanks! I'm trying the @CheckReturnValue
approach with a PR to the project (I'm not on it), see joel-costigliola/assertj-core#436.
Fixing #422 will address this issue.
AssertJ and FEST assertions are commonly used in different projects. Boolean assertions take the form
assertThat(<expression>).isTrue();
orassertThat(<expression>).isFalse();
.A common mistake, visually easy to miss, is to just write
assertThat(<expression>);
. Someone unfamiliar with the assertion library may assume this would check that the expression evaluates to true. However, no assertion is made on the evaluated expression. I propose error-prone has a FAIL check onassertThat(<expression>);
.