# Package groovy.org.codenarc.rule.junit

- Class Summary
  Class | Description
  --- | ---
  AssertionTrap | Visits code searching for assert statements or assert.* method calls.
  ChainedTestAstVisitor |
  ChainedTestRule | A test method that invokes another test method is a chained test; the methods are dependent on one another.
  CoupledTestCaseAstVisitor |
  CoupledTestCaseRule | This rule finds test cases that are coupled to other test cases, either by invoking static methods on another test case or by creating instances of another test case.
  JUnitAssertAlwaysFailsAstVisitor |
  JUnitAssertAlwaysFailsRule | Rule that checks for JUnit `assert()` method calls with constant arguments such that the assertion always fails.
  JUnitAssertAlwaysSucceedsAstVisitor |
  JUnitAssertAlwaysSucceedsRule | Rule that checks for JUnit `assert()` method calls with constant arguments such that the assertion always succeeds.
  JUnitAssertEqualsConstantActualValueAstVisitor |
  JUnitAssertEqualsConstantActualValueRule | Reports usages of org.junit.Assert.assertEquals([message,] expected, actual) where the 'actual' parameter is a constant or a literal.
  JUnitFailWithoutMessageRule | This rule detects JUnit calling the fail() method without an argument.
  JUnitFailWithoutMessageRuleAstVisitor |
  JUnitLostTestAstVisitor |

  JUnitLostTestRule

  Rule that checks if a JUnit 4 test class contains public, instance, void, no-arg methods named test*() that are NOT annotated with
  Test.:

  JUnitPublicFieldAstVisitor |
  JUnitPublicFieldRule | Checks for public field on a JUnit test class.
  JUnitPublicNonTestMethodAstVisitor |

  JUnitPublicNonTestMethodRule

  Rule that checks if a JUnit test class contains public methods other than:
  - Zero-argument methods with names starting with "test"
  - The setUp() and tearDown() methods
  - Methods annotated with @Test
  - Methods annotated with
    Before:
      and
    @After
  - Methods annotated with
    BeforeClass:
      and
    @AfterClass
  Public, non-test methods on a test class violate conventional usage of test classes, and can be confusing.

  JUnitPublicPropertyAstVisitor |
  JUnitPublicPropertyRule | Checks for public properties defined on JUnit test classes.
  JUnitSetUpCallsSuperAstVisitor |
  JUnitSetUpCallsSuperRule | Rule that checks that if the JUnit `setUp()` method is defined, that it includes a call to `super.setUp()`.
  JUnitStyleAssertionsAstVisitor |
  JUnitStyleAssertionsRule | This rule detects calling JUnit style assertions like assertEquals, assertTrue, assertFalse, assertNull, assertNotNull.
  JUnitTearDownCallsSuperAstVisitor |
  JUnitTearDownCallsSuperRule | Rule that checks that if the JUnit `tearDown()` method is defined, that it includes a call to `super.tearDown()`.
  JUnitTestMethodWithoutAssertAstVisitor |
  JUnitTestMethodWithoutAssertRule | This rule searches for test methods that do not contain assert statements.
  JUnitUnnecessarySetUpAstVisitor |
  JUnitUnnecessarySetUpRule | Rule that checks for a JUnit `setUp()` method that only contains a call to `super.setUp()`.
  JUnitUnnecessaryTearDownAstVisitor |
  JUnitUnnecessaryTearDownRule | Rule that checks for a JUnit `tearDown()` method that only contains a call to `super.tearDown()`.
  JUnitUnnecessaryThrowsExceptionAstVisitor |
  JUnitUnnecessaryThrowsExceptionRule | Check for throws clauses on JUnit test methods.
  JUnitUtil | Utility methods for JUnit rule classes.
  SpockIgnoreRestUsedAstVisitor |

  SpockIgnoreRestUsedRule

  If Spock's
  IgnoreRest:
    on any method, all non-annotated test methods are not executed.

  UnnecessaryFailAstVisitor |
  UnnecessaryFailRule | In a unit test, catching an exception and immedietly calling Assert.fail() is pointless and hides the stack trace.
  UseAssertEqualsInsteadOfAssertTrueAstVisitor |
  UseAssertEqualsInsteadOfAssertTrueRule | This rule detects JUnit assertions in object equality.
  UseAssertFalseInsteadOfNegationAstVisitor |
  UseAssertFalseInsteadOfNegationRule | In unit tests, if a condition is expected to be false then there is no sense using assertTrue with the negation operator.
  UseAssertNullInsteadOfAssertEqualsAstVisitor |
  UseAssertNullInsteadOfAssertEqualsRule | This rule detects JUnit calling assertEquals where the first or second parameter is null.
  UseAssertSameInsteadOfAssertTrueAstVisitor |
  UseAssertSameInsteadOfAssertTrueRule | This rule detects JUnit calling assertTrue where the first or second parameter is an Object#is() call testing for reference equality.
  UseAssertTrueInsteadOfAssertEqualsAstVisitor |
  UseAssertTrueInsteadOfAssertEqualsRule | This rule detects JUnit calling assertEquals where the first parameter is a boolean.
  UseAssertTrueInsteadOfNegationAstVisitor |
  UseAssertTrueInsteadOfNegationRule | In unit tests, if a condition is expected to be true then there is no sense using assertFalse with the negation operator.