Class AbstractRuleTestCase<T extends Rule>

  • All Implemented Interfaces:
    groovy.lang.GroovyObject

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

      • CONSTRUCTOR_METHOD_NAME

        protected static final java.lang.Object CONSTRUCTOR_METHOD_NAME
      • DEFAULT_TEST_FILES

        protected static final java.lang.Object DEFAULT_TEST_FILES
      • DEFAULT_TEST_CLASS_NAMES

        protected static final java.lang.Object DEFAULT_TEST_CLASS_NAMES
      • rule

        protected T extends Rule rule
      • sourceCodeName

        protected java.lang.String sourceCodeName
      • sourceCodePath

        protected java.lang.String sourceCodePath
    • Constructor Detail

      • AbstractRuleTestCase

        public AbstractRuleTestCase()
    • Method Detail

      • assertSingleViolation

        protected void assertSingleViolation​(java.lang.String source,
                                             java.lang.Integer lineNumber,
                                             java.lang.String sourceLineText)
      • assertSingleViolation

        protected void assertSingleViolation​(java.lang.String source,
                                             java.lang.Integer lineNumber)
      • assertSingleViolation

        protected void assertSingleViolation​(java.lang.String source)
      • assertViolation

        protected void assertViolation​(Violation violation,
                                       java.lang.Integer lineNumber,
                                       java.lang.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 java.lang.Object invokeMethod​(java.lang.String method,
                                             java.lang.Object arguments)
        Specified by:
        invokeMethod in interface groovy.lang.GroovyObject
        Overrides:
        invokeMethod in class AbstractTestCase
      • getProperty

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

        public void setProperty​(java.lang.String property,
                                java.lang.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​(java.lang.String source,
                                           java.lang.Integer lineNumber1,
                                           java.lang.String sourceLineText1,
                                           java.lang.Integer lineNumber2,
                                           java.lang.String sourceLineText2)
      • assertInlineViolations

        protected void assertInlineViolations​(java.lang.String annotatedSource)
      • inlineViolation

        protected static java.lang.String inlineViolation​(java.lang.String violationMessage)
      • removeInlineViolations

        protected static java.lang.String removeInlineViolations​(java.lang.String annotatedSource)
      • assertViolations

        protected void assertViolations​(java.lang.String source,
                                        java.util.Map... violationMaps)
      • assertTwoViolations

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

        protected void assertSingleViolation​(java.lang.String source,
                                             java.lang.Integer lineNumber,
                                             java.lang.String sourceLineText,
                                             java.lang.Object messageText)
      • assertSingleViolation

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

        protected void assertNoViolations​(java.lang.String source)
      • assertViolation

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

        protected java.util.List applyRuleTo​(java.lang.String source)
      • manuallyApplyRule

        protected java.util.List manuallyApplyRule​(java.lang.String source)
      • setUpAbstractRuleTestCase

        public void setUpAbstractRuleTestCase()