Class TestCaseTools.SingleInstanceTestSuite

  • All Implemented Interfaces:
    junit.framework.Test
    Enclosing class:
    TestCaseTools

    public static class TestCaseTools.SingleInstanceTestSuite
    extends junit.framework.TestSuite
    This is a special version of TestSuite that fixes, once and for all, the irritating design of JUnit to invoke the constructor multiple times on a test class. This operates as follows: construct an instance of the test class in inst try { for each test method method.invoke( inst ) ; } catch ... { } finally { invoke post method (if any) }
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.Method postMethod  
      private java.lang.reflect.Method setUpMethod  
      private java.lang.reflect.Method tearDownMethod  
      private junit.framework.Test test  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addTestMethod​(java.lang.reflect.Method m, java.util.Vector names, junit.framework.Test test)  
      private junit.framework.Test doWarning​(java.lang.String message)  
      private java.lang.String exceptionToString​(java.lang.Throwable t)  
      private java.lang.reflect.Method getMethod​(java.lang.Class theClass, java.lang.String name)  
      private boolean isPublicTestMethod​(java.lang.reflect.Method m)  
      private boolean isTestMethod​(java.lang.reflect.Method m)  
      void run​(junit.framework.TestResult result)  
      void runTest​(junit.framework.Test test, junit.framework.TestResult result)  
      • Methods inherited from class junit.framework.TestSuite

        addTest, addTestSuite, countTestCases, createTest, getName, getTestConstructor, setName, testAt, testCount, tests, toString, warning
      • Methods inherited from class java.lang.Object

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

      • test

        private junit.framework.Test test
      • setUpMethod

        private java.lang.reflect.Method setUpMethod
      • tearDownMethod

        private java.lang.reflect.Method tearDownMethod
      • postMethod

        private java.lang.reflect.Method postMethod
    • Constructor Detail

      • SingleInstanceTestSuite

        public SingleInstanceTestSuite​(java.lang.Class theClass)
    • Method Detail

      • getMethod

        private java.lang.reflect.Method getMethod​(java.lang.Class theClass,
                                                   java.lang.String name)
      • addTestMethod

        private void addTestMethod​(java.lang.reflect.Method m,
                                   java.util.Vector names,
                                   junit.framework.Test test)
      • isPublicTestMethod

        private boolean isPublicTestMethod​(java.lang.reflect.Method m)
      • isTestMethod

        private boolean isTestMethod​(java.lang.reflect.Method m)
      • exceptionToString

        private java.lang.String exceptionToString​(java.lang.Throwable t)
      • run

        public void run​(junit.framework.TestResult result)
        Specified by:
        run in interface junit.framework.Test
        Overrides:
        run in class junit.framework.TestSuite
      • runTest

        public void runTest​(junit.framework.Test test,
                            junit.framework.TestResult result)
        Overrides:
        runTest in class junit.framework.TestSuite
      • doWarning

        private junit.framework.Test doWarning​(java.lang.String message)