Class AbstractRuleTestCase<T extends Rule>

java.lang.Object
org.codenarc.test.AbstractTestCase
org.codenarc.rule.AbstractRuleTestCase<T>
All Implemented Interfaces:
groovy.lang.GroovyObject

public abstract class AbstractRuleTestCase<T extends Rule> extends AbstractTestCase implements groovy.lang.GroovyObject
  • Field Details

    • CONSTRUCTOR_METHOD_NAME

      protected static final Object CONSTRUCTOR_METHOD_NAME
    • DEFAULT_TEST_FILES

      protected static final Object DEFAULT_TEST_FILES
    • DEFAULT_TEST_CLASS_NAMES

      protected static final Object DEFAULT_TEST_CLASS_NAMES
    • rule

      protected T extends Rule rule
    • sourceCodeName

      protected String sourceCodeName
    • sourceCodePath

      protected String sourceCodePath
  • Constructor Details

    • AbstractRuleTestCase

      public AbstractRuleTestCase()
  • Method Details

    • assertSingleViolation

      protected void assertSingleViolation(String source, Integer lineNumber, String sourceLineText)
    • assertSingleViolation

      protected void assertSingleViolation(String source, Integer lineNumber)
    • assertSingleViolation

      protected void assertSingleViolation(String source)
    • assertViolation

      protected void assertViolation(Violation violation, Integer lineNumber, String sourceLineText)
    • getMetaClass

      public groovy.lang.MetaClass getMetaClass()
      Specified by:
      getMetaClass in interface groovy.lang.GroovyObject
      Overrides:
      getMetaClass in class AbstractTestCase
    • setMetaClass

      public void setMetaClass(groovy.lang.MetaClass mc)
      Specified by:
      setMetaClass in interface groovy.lang.GroovyObject
      Overrides:
      setMetaClass in class AbstractTestCase
    • invokeMethod

      public Object invokeMethod(String method, Object arguments)
      Specified by:
      invokeMethod in interface groovy.lang.GroovyObject
      Overrides:
      invokeMethod in class AbstractTestCase
    • getProperty

      public Object getProperty(String property)
      Specified by:
      getProperty in interface groovy.lang.GroovyObject
      Overrides:
      getProperty in class AbstractTestCase
    • setProperty

      public void setProperty(String property, Object value)
      Specified by:
      setProperty in interface groovy.lang.GroovyObject
      Overrides:
      setProperty in class AbstractTestCase
    • testThatUnrelatedCodeHasNoViolations

      public void testThatUnrelatedCodeHasNoViolations()
    • testThatInvalidCodeHasNoViolations

      public void testThatInvalidCodeHasNoViolations()
    • testThatApplyToFilesMatchingValuesAreValidRegex

      public void testThatApplyToFilesMatchingValuesAreValidRegex()
    • createRule

      protected abstract T createRule()
    • assertTwoViolations

      protected void assertTwoViolations(String source, Integer lineNumber1, String sourceLineText1, Integer lineNumber2, String sourceLineText2)
    • assertInlineViolations

      protected void assertInlineViolations(String annotatedSource)
    • inlineViolation

      protected static String inlineViolation(String violationMessage)
    • removeInlineViolations

      protected static String removeInlineViolations(String annotatedSource)
    • assertViolations

      protected void assertViolations(String source, Map... violationMaps)
    • assertTwoViolations

      protected void assertTwoViolations(String source, Integer lineNumber1, String sourceLineText1, Object msg1, Integer lineNumber2, String sourceLineText2, Object msg2)
    • assertSingleViolation

      protected void assertSingleViolation(String source, Integer lineNumber, String sourceLineText, Object messageText)
    • assertSingleViolation

      protected void assertSingleViolation(String source, groovy.lang.Closure closure)
    • assertNoViolations

      protected void assertNoViolations(String source)
    • assertViolation

      protected void assertViolation(Violation violation, Integer lineNumber, String sourceLineText, Object messageText)
    • applyRuleTo

      protected List applyRuleTo(String source)
    • manuallyApplyRule

      protected List manuallyApplyRule(String source)
    • setUpAbstractRuleTestCase

      public void setUpAbstractRuleTestCase()