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
Fields Modifier and Type Field Description protected static java.lang.ObjectCONSTRUCTOR_METHOD_NAMEprotected static java.lang.ObjectDEFAULT_TEST_CLASS_NAMESprotected static java.lang.ObjectDEFAULT_TEST_FILESprotected Truleprotected java.lang.StringsourceCodeNameprotected java.lang.StringsourceCodePath-
Fields inherited from class org.codenarc.test.AbstractTestCase
CODENARC_PROPERTIES_FILE_PROP, LOG, testName
-
-
Constructor Summary
Constructors Constructor Description AbstractRuleTestCase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.ListapplyRuleTo(java.lang.String source)protected voidassertInlineViolations(java.lang.String annotatedSource)protected voidassertNoViolations(java.lang.String source)protected voidassertSingleViolation(java.lang.String source)protected voidassertSingleViolation(java.lang.String source, groovy.lang.Closure closure)protected voidassertSingleViolation(java.lang.String source, java.lang.Integer lineNumber)protected voidassertSingleViolation(java.lang.String source, java.lang.Integer lineNumber, java.lang.String sourceLineText)protected voidassertSingleViolation(java.lang.String source, java.lang.Integer lineNumber, java.lang.String sourceLineText, java.lang.Object messageText)protected voidassertTwoViolations(java.lang.String source, java.lang.Integer lineNumber1, java.lang.String sourceLineText1, java.lang.Integer lineNumber2, java.lang.String sourceLineText2)protected voidassertTwoViolations(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)protected voidassertViolation(Violation violation, java.lang.Integer lineNumber, java.lang.String sourceLineText)protected voidassertViolation(Violation violation, java.lang.Integer lineNumber, java.lang.String sourceLineText, java.lang.Object messageText)protected voidassertViolations(java.lang.String source, java.util.Map... violationMaps)protected abstract TcreateRule()groovy.lang.MetaClassgetMetaClass()java.lang.ObjectgetProperty(java.lang.String property)protected static java.lang.StringinlineViolation(java.lang.String violationMessage)java.lang.ObjectinvokeMethod(java.lang.String method, java.lang.Object arguments)protected java.util.ListmanuallyApplyRule(java.lang.String source)protected static java.lang.StringremoveInlineViolations(java.lang.String annotatedSource)voidsetMetaClass(groovy.lang.MetaClass mc)voidsetProperty(java.lang.String property, java.lang.Object value)voidsetUpAbstractRuleTestCase()voidtestThatApplyToFilesMatchingValuesAreValidRegex()voidtestThatInvalidCodeHasNoViolations()voidtestThatUnrelatedCodeHasNoViolations()-
Methods inherited from class org.codenarc.test.AbstractTestCase
getName, log, setUpAbstractTestCase
-
-
-
-
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
-
sourceCodeName
protected java.lang.String sourceCodeName
-
sourceCodePath
protected java.lang.String sourceCodePath
-
-
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:
getMetaClassin interfacegroovy.lang.GroovyObject- Overrides:
getMetaClassin classAbstractTestCase
-
setMetaClass
public void setMetaClass(groovy.lang.MetaClass mc)
- Specified by:
setMetaClassin interfacegroovy.lang.GroovyObject- Overrides:
setMetaClassin classAbstractTestCase
-
invokeMethod
public java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)- Specified by:
invokeMethodin interfacegroovy.lang.GroovyObject- Overrides:
invokeMethodin classAbstractTestCase
-
getProperty
public java.lang.Object getProperty(java.lang.String property)
- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject- Overrides:
getPropertyin classAbstractTestCase
-
setProperty
public void setProperty(java.lang.String property, java.lang.Object value)- Specified by:
setPropertyin interfacegroovy.lang.GroovyObject- Overrides:
setPropertyin classAbstractTestCase
-
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()
-
-