public abstract class AbstractRuleTestCase<T extends Rule> extends AbstractTestCase
Modifier and Type | Field | Description |
---|---|---|
protected static Object |
CONSTRUCTOR_METHOD_NAME |
|
protected static Object |
DEFAULT_TEST_CLASS_NAMES |
|
protected static Object |
DEFAULT_TEST_FILES |
|
protected T |
rule |
|
protected String |
sourceCodeName |
|
protected String |
sourceCodePath |
CODENARC_PROPERTIES_FILE_PROP, LOG, testName
Constructor | Description |
---|---|
AbstractRuleTestCase() |
Modifier and Type | Method | 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 T |
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 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 class AbstractTestCase
public void setMetaClass(groovy.lang.MetaClass mc)
setMetaClass
in class AbstractTestCase
public Object invokeMethod(String method, Object arguments)
invokeMethod
in class AbstractTestCase
public Object getProperty(String property)
getProperty
in class AbstractTestCase
public void setProperty(String property, Object value)
setProperty
in class AbstractTestCase
public void testThatUnrelatedCodeHasNoViolations()
public void testThatInvalidCodeHasNoViolations()
public void testThatApplyToFilesMatchingValuesAreValidRegex()
protected abstract T 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 © 2019. All rights reserved.