org.codenarc.rule
Class AbstractRuleTestCase

java.lang.Object
  extended by org.codenarc.test.AbstractTestCase
      extended by org.codenarc.rule.AbstractRuleTestCase
All Implemented Interfaces:
groovy.lang.GroovyObject

public abstract class AbstractRuleTestCase
extends AbstractTestCase
implements groovy.lang.GroovyObject


Field Summary
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
           
 
Fields inherited from class org.codenarc.test.AbstractTestCase
CODENARC_PROPERTIES_FILE_PROP, LOG, testName
 
Constructor Summary
AbstractRuleTestCase()
           
 
Method Summary
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()
           
 
Methods inherited from class org.codenarc.test.AbstractTestCase
getName, log, setUpAbstractTestCase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTRUCTOR_METHOD_NAME

protected static Object CONSTRUCTOR_METHOD_NAME

DEFAULT_TEST_FILES

protected static Object DEFAULT_TEST_FILES

DEFAULT_TEST_CLASS_NAMES

protected static Object DEFAULT_TEST_CLASS_NAMES

rule

protected Rule rule

sourceCodeName

protected String sourceCodeName

sourceCodePath

protected String sourceCodePath
Constructor Detail

AbstractRuleTestCase

public AbstractRuleTestCase()
Method Detail

assertSingleViolation

protected void assertSingleViolation(String source,
                                     Integer lineNumber,
                                     String sourceLineText)

assertSingleViolation

protected void assertSingleViolation(String source,
                                     Integer lineNumber)

assertSingleViolation

protected void assertSingleViolation(String source)

assertViolation

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

getProperty

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

setProperty

public void setProperty(String property,
                        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 Rule createRule()

assertTwoViolations

protected void assertTwoViolations(String source,
                                   Integer lineNumber1,
                                   String sourceLineText1,
                                   Integer lineNumber2,
                                   String sourceLineText2)

assertInlineViolations

protected void assertInlineViolations(String annotatedSource)

inlineViolation

protected static String inlineViolation(String violationMessage)

removeInlineViolations

protected static String removeInlineViolations(String annotatedSource)

assertViolations

protected void assertViolations(String source,
                                Map[] violationMaps)

assertTwoViolations

protected void assertTwoViolations(String source,
                                   Integer lineNumber1,
                                   String sourceLineText1,
                                   Object msg1,
                                   Integer lineNumber2,
                                   String sourceLineText2,
                                   Object msg2)

assertSingleViolation

protected void assertSingleViolation(String source,
                                     Integer lineNumber,
                                     String sourceLineText,
                                     Object messageText)

assertSingleViolation

protected void assertSingleViolation(String source,
                                     groovy.lang.Closure closure)

assertNoViolations

protected void assertNoViolations(String source)

assertViolation

protected void assertViolation(Violation violation,
                               Integer lineNumber,
                               String sourceLineText,
                               Object messageText)

applyRuleTo

protected List applyRuleTo(String source)

manuallyApplyRule

protected List manuallyApplyRule(String source)

setUpAbstractRuleTestCase

public void setUpAbstractRuleTestCase()


Copyright © 2014. All rights reserved.