Package ghidra.util

Class TestSuiteUtilities


  • public class TestSuiteUtilities
    extends java.lang.Object
    A set of static utilities to facilitate JUnit testing.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void createTestSuites​(java.io.File baseDir, java.lang.String className, java.lang.String pkgName)
      Create the Java source file a JUnit TestSuite which includes all TestCases within a package directory.
      static int createTestSuites​(java.io.File baseDir, java.lang.String className, java.lang.String pkgName, boolean recurse)
      Create the Java source file a JUnit TestSuite which includes all TestCases within a package directory.
      static java.util.Iterator<java.lang.String> getClassNames​(java.lang.String pkgName, java.lang.Class<?> searchClass)
      Get all class names within the named package which extend or implement the specified search class.
      static junit.framework.TestSuite getPkgTestSuite​(java.lang.String pkgName)
      Build JUnit test suite for the specified package only.
      static java.util.Iterator<java.lang.String> getSubPkgNames​(java.lang.String pkgName)
      Get all potential package names within the named package.
      static junit.framework.TestSuite getTestSuite​(java.lang.String pkgName)
      Build JUnit test suite for the specified package.
      static void main​(java.lang.String[] args)
      Command-line utilities.
      • Methods inherited from class java.lang.Object

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

      • TestSuiteUtilities

        public TestSuiteUtilities()
    • Method Detail

      • getTestSuite

        public static junit.framework.TestSuite getTestSuite​(java.lang.String pkgName)
        Build JUnit test suite for the specified package. TestSuite includes sub-TestSuites for each sub-package.
        Parameters:
        pkgName - the java package name
        Returns:
        test suite
      • getPkgTestSuite

        public static junit.framework.TestSuite getPkgTestSuite​(java.lang.String pkgName)
        Build JUnit test suite for the specified package only.
        Parameters:
        pkgName - the java package name
        Returns:
        test suite
      • getClassNames

        public static java.util.Iterator<java.lang.String> getClassNames​(java.lang.String pkgName,
                                                                         java.lang.Class<?> searchClass)
        Get all class names within the named package which extend or implement the specified search class.
        Parameters:
        pkgName - package name
        searchClass - base or interface class to search for.
      • getSubPkgNames

        public static java.util.Iterator<java.lang.String> getSubPkgNames​(java.lang.String pkgName)
        Get all potential package names within the named package.
        Parameters:
        pkgName - package name
      • createTestSuites

        public static void createTestSuites​(java.io.File baseDir,
                                            java.lang.String className,
                                            java.lang.String pkgName)
                                     throws java.io.IOException
        Create the Java source file a JUnit TestSuite which includes all TestCases within a package directory.
        Parameters:
        baseDir - the base package directory
        className - the class name
        pkgName - the java package name
        Throws:
        java.io.IOException
      • createTestSuites

        public static int createTestSuites​(java.io.File baseDir,
                                           java.lang.String className,
                                           java.lang.String pkgName,
                                           boolean recurse)
                                    throws java.io.IOException
        Create the Java source file a JUnit TestSuite which includes all TestCases within a package directory.
        Parameters:
        baseDir -
        className -
        pkgName -
        recurse -
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
        Command-line utilities.

        Parameter usage:

            createAllTests <baseDirPath> <className> <topPackage>
         
        Parameters:
        args -