Automatically suppress false positive for BooleanParameter in JUnit assertEquals
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
I've just hit this:
> [WARNING] /home/vorburger/dev/ODL/git/infrautils/common/util/src/test/java/org/opendaylight/infrautils/utils/concurrent/KeyedLocksTest.java:[90,40] [BooleanParameter] Use parameter comments to document ambiguous literals (see http://errorprone.info/bugpattern/BooleanParameter)
> Did you mean 'assertEquals("Thread isAlive", /* expected= */false, thread1.isAlive());'?
so a [BooleanParameter](http://errorprone.info/bugpattern/BooleanParameter) warning for:
assertEquals("Thread isAlive", false, thread1.isAlive());
but that proposed `/* expected= */` would be just visual noise IMHO - `assertEquals` is a well enough known that this is pretty clear as is... perhaps this could somehow be added to the automatic supression list?
PS: Unfortunately in JUnit 4 at least (have not checked JUnit 5) there is no assertEquals(boolean expected, boolean actual) but that uses assertEquals(Object expected, Object actual) - not sure if that makes white listing this any more difficult.
Contributor guide
Assessment
This issue has not been assessed yet.