Class AbstractRuleSetFactoryTest


  • public abstract class AbstractRuleSetFactoryTest
    extends java.lang.Object
    Base test class to verify the language's rulesets. This class should be subclassed for each language.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<java.lang.String> validXPathClassNames  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static net.sourceforge.pmd.RuleSetReferenceId createRuleSetReferenceId​(java.lang.String ruleSetXml)
      Create a RuleSetReferenceId by the given XML string.
      static void init()
      Setups the XML parser with validation.
      void testAllPMDBuiltInRulesMeetConventions()
      Checks all rulesets of all languages on the classpath and verifies that all required attributes for all rules are specified.
      void testDtd()
      Verifies that all rulesets are valid XML according to the DTD.
      void testReadWriteRoundTrip()
      Reads and writes the rulesets to make sure, that no data is lost if the rulests are processed.
      void testXmlSchema()
      Verifies that all rulesets are valid XML according to the xsd schema.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • validXPathClassNames

        protected java.util.Set<java.lang.String> validXPathClassNames
    • Constructor Detail

      • AbstractRuleSetFactoryTest

        public AbstractRuleSetFactoryTest()
    • Method Detail

      • init

        public static void init()
                         throws java.lang.Exception
        Setups the XML parser with validation.
        Throws:
        java.lang.Exception - any error
      • testAllPMDBuiltInRulesMeetConventions

        public void testAllPMDBuiltInRulesMeetConventions()
                                                   throws java.lang.Exception
        Checks all rulesets of all languages on the classpath and verifies that all required attributes for all rules are specified.
        Throws:
        java.lang.Exception - any error
      • testXmlSchema

        public void testXmlSchema()
                           throws java.lang.Exception
        Verifies that all rulesets are valid XML according to the xsd schema.
        Throws:
        java.lang.Exception - any error
      • testDtd

        public void testDtd()
                     throws java.lang.Exception
        Verifies that all rulesets are valid XML according to the DTD.
        Throws:
        java.lang.Exception - any error
      • testReadWriteRoundTrip

        public void testReadWriteRoundTrip()
                                    throws java.lang.Exception
        Reads and writes the rulesets to make sure, that no data is lost if the rulests are processed.
        Throws:
        java.lang.Exception - any error
      • createRuleSetReferenceId

        protected static net.sourceforge.pmd.RuleSetReferenceId createRuleSetReferenceId​(java.lang.String ruleSetXml)
        Create a RuleSetReferenceId by the given XML string.
        Parameters:
        ruleSetXml - the ruleset file content as string
        Returns:
        the RuleSetReferenceId