google / google/error-prone

Check for unused AssertJ/FEST boolean assertion (e.g. assertThat(<expr>);)

Open
#308 4 comments 0 reactions 0 assignees View on GitHub
Type-NewCheck
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

[AssertJ](http://joel-costigliola.github.io/assertj/) and [FEST](https://github.com/alexruiz/fest-assert-2.x) assertions are commonly used in different projects. Boolean assertions take the form `assertThat().isTrue();` or `assertThat().isFalse();`.

A common mistake, visually easy to miss, is to just write `assertThat();`. 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 on `assertThat();`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.