Cleanup
Composite Recipes
Recipes that include further recipes, often including the individual recipes below.
- Replace JUnit
assertTrue(false, "reason")andassertFalse(true, "reason")withfail("reason") - Testing best practices
Recipes
- Assertion arguments should be passed in the correct order
- Include an assertion in tests
- Junit
assertTrue(a == b)toassertEquals(a,b) - Refaster template
AssertLiteralBooleanToFail.WithMessage - Refaster template
AssertLiteralBooleanToFail.WithoutMessage - Remove JUnit
assertTrue(true)andassertFalse(false) - Remove empty tests without comments
- Remove
publicvisibility of JUnit 5 tests - Remove
testprefix from JUnit 5 tests - Replace JUnit
assertEquals(false, <boolean>)toassertFalse(<boolean>)/assertTrue(<boolean>) - Replace JUnit
assertFalse(!<boolean>)toassertTrue(<boolean>) - Replace JUnit
assertFalse(a == null)toassertNotNull(a) - Replace JUnit
assertFalse(a.equals(b))toassertNotEquals(a,b) - Replace JUnit
assertNotEquals(false, <boolean>)toassertFalse(<boolean>)/assertTrue(<boolean>) - Replace JUnit
assertTrue(!<boolean>)toassertFalse(<boolean>) - Replace JUnit
assertTrue(a == null)toassertNull(a) - Replace JUnit
assertTrue(a.equals(b))toassertEquals(a,b) - Simplify
throwsstatements of tests - Test methods should have void return type
assertEquals(a, null)toassertNull(a)