Class PMDTestRunner

  • All Implemented Interfaces:
    org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable

    public class PMDTestRunner
    extends org.junit.runner.Runner
    implements org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable
    A JUnit Runner, that combines the default JUnit4 and our custom RuleTestRunner. It allows to selectively execute single test cases (it is Filterable).

    Note: Since we actually run two runners one after another, the static BeforeClass and methods will be executed twice and the test class will be instantiated twice, too.

    In order to use it, you'll need to subclass SimpleAggregatorTst and annotate your test class with RunWith:

     @RunWith(PMDTestRunner.class)
     public class MyRuleSetTest extends SimpleAggregatorTst {
     ...
     }
     
    • Constructor Detail

      • PMDTestRunner

        public PMDTestRunner​(Class<? extends SimpleAggregatorTst> klass)
                      throws org.junit.runners.model.InitializationError
        Throws:
        org.junit.runners.model.InitializationError
    • Method Detail

      • filter

        public void filter​(org.junit.runner.manipulation.Filter filter)
                    throws org.junit.runner.manipulation.NoTestsRemainException
        Specified by:
        filter in interface org.junit.runner.manipulation.Filterable
        Throws:
        org.junit.runner.manipulation.NoTestsRemainException
      • getDescription

        public org.junit.runner.Description getDescription()
        Specified by:
        getDescription in interface org.junit.runner.Describable
        Specified by:
        getDescription in class org.junit.runner.Runner
      • run

        public void run​(org.junit.runner.notification.RunNotifier notifier)
        Specified by:
        run in class org.junit.runner.Runner
      • sort

        public void sort​(org.junit.runner.manipulation.Sorter sorter)
        Specified by:
        sort in interface org.junit.runner.manipulation.Sortable