public abstract class AbstractRuleTestCase extends AbstractTestCase
Modifier and Type | Field and Description |
---|---|
protected static Object |
CONSTRUCTOR_METHOD_NAME |
protected static Object |
DEFAULT_TEST_CLASS_NAMES |
protected static Object |
DEFAULT_TEST_FILES |
protected Rule |
rule |
protected String |
sourceCodeName |
protected String |
sourceCodePath |
CODENARC_PROPERTIES_FILE_PROP, LOG, testName
Constructor and Description |
---|
AbstractRuleTestCase() |
Modifier and Type | Method and Description |
---|---|
protected 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 Rule |
createRule() |
groovy.lang.MetaClass |
getMetaClass() |
Object |
getProperty(String property) |
protected static String |
inlineViolation(String violationMessage) |
Object |
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 |
setUpAbstractRuleTestCase() |
void |
testThatApplyToFilesMatchingValuesAreValidRegex() |
void |
testThatInvalidCodeHasNoViolations() |
void |
testThatUnrelatedCodeHasNoViolations() |
getName, log, setUpAbstractTestCase
protected static final Object CONSTRUCTOR_METHOD_NAME
protected static final Object DEFAULT_TEST_FILES
protected static final Object DEFAULT_TEST_CLASS_NAMES
protected Rule rule
protected String sourceCodeName
protected String sourceCodePath
protected void assertSingleViolation(String source, Integer lineNumber, String sourceLineText)
protected void assertSingleViolation(String source)
protected void assertViolation(Violation violation, Integer lineNumber, String sourceLineText)
public groovy.lang.MetaClass getMetaClass()
getMetaClass
in interface groovy.lang.GroovyObject
getMetaClass
in class AbstractTestCase
public void setMetaClass(groovy.lang.MetaClass mc)
setMetaClass
in interface groovy.lang.GroovyObject
setMetaClass
in class AbstractTestCase
public Object invokeMethod(String method, Object arguments)
invokeMethod
in interface groovy.lang.GroovyObject
invokeMethod
in class AbstractTestCase
public Object getProperty(String property)
getProperty
in interface groovy.lang.GroovyObject
getProperty
in class AbstractTestCase
public void setProperty(String property, Object value)
setProperty
in interface groovy.lang.GroovyObject
setProperty
in class AbstractTestCase
public void testThatUnrelatedCodeHasNoViolations()
public void testThatInvalidCodeHasNoViolations()
public void testThatApplyToFilesMatchingValuesAreValidRegex()
protected abstract Rule createRule()
protected void assertTwoViolations(String source, Integer lineNumber1, String sourceLineText1, Integer lineNumber2, String sourceLineText2)
protected void assertInlineViolations(String annotatedSource)
protected void assertTwoViolations(String source, Integer lineNumber1, String sourceLineText1, Object msg1, Integer lineNumber2, String sourceLineText2, Object msg2)
protected void assertSingleViolation(String source, Integer lineNumber, String sourceLineText, Object messageText)
protected void assertSingleViolation(String source, groovy.lang.Closure closure)
protected void assertNoViolations(String source)
protected void assertViolation(Violation violation, Integer lineNumber, String sourceLineText, Object messageText)
public void setUpAbstractRuleTestCase()
Copyright © 2022. All rights reserved.