JUnit
- '@RunWith' annotation already exists in a parent class
Reports when parent and child classes in a JUnit test hierarchy are annotated with @RunWith.
- 'assertEquals()' called on array
Reports JUnit assertEquals() calls with arguments of an array type.
- 'assertEquals()' may be 'assertSame()'
Reports JUnit assertEquals() calls that can be replaced with an equivalent assertSame() call.
- Expected exception never thrown in test method body
Reports checked exceptions expected by a JUnit 4 test-method that are never thrown inside the method body.
- JUnit 3 'super.tearDown()' is not called from 'finally' block
Reports calls of the JUnit 3's super.tearDown() method that are not performed inside a finally block.
- JUnit 3 test can be JUnit 4
Reports JUnit 3 test classes that can be converted to JUnit 4 test classes.
- JUnit 4 test can be JUnit 5
Reports JUnit 4 tests that can be automatically migrated to JUnit 5.
- JUnit 5 obsolete assertions
Reports any calls to methods from the junit.framework.Assert, org.junit.Assert, or org.junit.Assume classes inside JUnit 5 tests.
- JUnit API usage from multiple versions in a single TestCase
Reports JUnit annotated methods when used in a test case from a different JUnit version.
- JUnit assertion can be 'assertThat()' call
Reports calls to Assert.assertEquals(), Assert.assertTrue(), etc.
- JUnit malformed declaration
Reports JUnit test member declarations that are malformed and are likely not recognized by the JUnit test framework.
- JUnit test annotated with '@Ignore'/'@Disabled'
Reports usages of JUnit 4's @Ignore or JUnit 5's @Disabled annotations.
- Multiple exceptions declared on test method
Reports JUnit test method throws clauses with more than one exception.
- Old style JUnit test method in JUnit 4 class
Reports JUnit 3 style test methods that are located inside a class that does not extend the JUnit 3 TestCase class and contains JUnit 4 or JUnit 5 @Test annotated methods.
- Parameterized test class without data provider method
Reports JUnit 4 parameterized test classes that are annotated with @RunWith(Parameterized.class) but either do not include a data provider method annotated with @Parameterized.Parameters or this method has an incorrect signature.
- Usage of obsolete 'junit.framework.Assert' method
Reports any calls to methods from the junit.framework.Assert class.