Package org.codenarc.rule
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 Summary
FieldsModifier and TypeFieldDescriptionprotected static final Object
protected static final Object
protected static final Object
protected T
protected String
protected String
Fields inherited from class org.codenarc.test.AbstractTestCase
CODENARC_PROPERTIES_FILE_PROP, LOG, testName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List
applyRuleTo
(String source) protected void
assertInlineViolations
(String annotatedSource) protected void
assertNoViolations
(String source) protected void
assertSingleViolation
(String source) protected void
assertSingleViolation
(String source, groovy.lang.Closure closure) protected void
assertSingleViolation
(String source, Integer lineNumber) protected void
assertSingleViolation
(String source, Integer lineNumber, String sourceLineText) protected void
assertSingleViolation
(String source, Integer lineNumber, String sourceLineText, Object messageText) protected void
assertTwoViolations
(String source, Integer lineNumber1, String sourceLineText1, Integer lineNumber2, String sourceLineText2) protected void
assertTwoViolations
(String source, Integer lineNumber1, String sourceLineText1, Object msg1, Integer lineNumber2, String sourceLineText2, Object msg2) protected void
assertViolation
(Violation violation, Integer lineNumber, String sourceLineText) protected void
assertViolation
(Violation violation, Integer lineNumber, String sourceLineText, Object messageText) protected void
assertViolations
(String source, Map... violationMaps) protected abstract T
groovy.lang.MetaClass
getProperty
(String property) protected static String
inlineViolation
(String violationMessage) invokeMethod
(String method, Object arguments) protected List
manuallyApplyRule
(String source) protected static String
removeInlineViolations
(String annotatedSource) void
setMetaClass
(groovy.lang.MetaClass mc) void
setProperty
(String property, Object value) void
void
void
void
Methods inherited from class org.codenarc.test.AbstractTestCase
getName, log, setUpAbstractTestCase
-
Field Details
-
CONSTRUCTOR_METHOD_NAME
-
DEFAULT_TEST_FILES
-
DEFAULT_TEST_CLASS_NAMES
-
rule
-
sourceCodeName
-
sourceCodePath
-
-
Constructor Details
-
AbstractRuleTestCase
public AbstractRuleTestCase()
-
-
Method Details
-
assertSingleViolation
-
assertSingleViolation
-
assertSingleViolation
-
assertViolation
-
getMetaClass
public groovy.lang.MetaClass getMetaClass()- Specified by:
getMetaClass
in interfacegroovy.lang.GroovyObject
- Overrides:
getMetaClass
in classAbstractTestCase
-
setMetaClass
public void setMetaClass(groovy.lang.MetaClass mc) - Specified by:
setMetaClass
in interfacegroovy.lang.GroovyObject
- Overrides:
setMetaClass
in classAbstractTestCase
-
invokeMethod
- Specified by:
invokeMethod
in interfacegroovy.lang.GroovyObject
- Overrides:
invokeMethod
in classAbstractTestCase
-
getProperty
- Specified by:
getProperty
in interfacegroovy.lang.GroovyObject
- Overrides:
getProperty
in classAbstractTestCase
-
setProperty
- Specified by:
setProperty
in interfacegroovy.lang.GroovyObject
- Overrides:
setProperty
in classAbstractTestCase
-
testThatInvalidCodeHasNoViolations
public void testThatInvalidCodeHasNoViolations() -
testThatApplyToFilesMatchingValuesAreValidRegex
public void testThatApplyToFilesMatchingValuesAreValidRegex() -
createRule
-
assertTwoViolations
-
assertInlineViolations
-
inlineViolation
-
removeInlineViolations
-
assertViolations
-
assertTwoViolations
-
assertSingleViolation
-
assertSingleViolation
-
assertNoViolations
-
assertViolation
-
applyRuleTo
-
manuallyApplyRule
-
setUpAbstractRuleTestCase
public void setUpAbstractRuleTestCase()
-