Class TestClassesUtil


  • public class TestClassesUtil
    extends java.lang.Object
    Gets all test classes that have hybris testing annotations

    All test classes that have the standard junit @Test annotation will be treated like a IntegrationTest.

    see IntegrationTest, DemoTest and UnitTest

    • Method Detail

      • setWebRelated

        public void setWebRelated​(boolean webRelated)
      • createIntegrationInstance

        public static TestClassesUtil createIntegrationInstance​(PlatformConfig platformConfig)
        Constructs an instance in the integrated environment. Where the full blown class loader is current for thread. Which is TestServlet in the hybrisServer or any other app server. We use original passed class loader.
      • createTestClassLoader

        public static java.lang.ClassLoader createTestClassLoader​(PlatformConfig platformConfig,
                                                                  java.lang.ClassLoader parent)
      • addTestSrcFoldersToClassPath

        public static void addTestSrcFoldersToClassPath​(PlatformConfig platformConfig,
                                                        groovy.lang.GroovyClassLoader ret)
      • getClassLoaderForTests

        public java.lang.ClassLoader getClassLoaderForTests()
      • getAllTestClasses

        public java.util.Collection<java.lang.Class> getAllTestClasses()
        This method resets all filters and scans for UnitTest, IntegrationTest, DemoTest, ManualTest and PerformanceTest annotated classes.
        Classes that only have @Test annotations before methods are treated as IntegrationTests.
        Returns:
        returns all test classes
      • getAllWebTestClasses

        public java.util.Collection<java.lang.Class> getAllWebTestClasses()
      • getAllUnitTestClasses

        public java.util.Collection<java.lang.Class> getAllUnitTestClasses()
        This method resets all filters and scans for UnitTest annotated classes.
        Returns:
        returns all test classes that are annotated with UnitTest
      • getAllIntegrationTestClasses

        public java.util.Collection<java.lang.Class> getAllIntegrationTestClasses()
        This method resets all filters and scans for IntegrationTest annotated classes.
        This method also returns classes that only have Test annotations before test methods!
        Returns:
        returns all test classes that are annotated with IntegrationTest or have at least one @Test annotation
      • getAllDemoTestClasses

        public java.util.Collection<java.lang.Class> getAllDemoTestClasses()
        This method resets all filters and scans for DemoTest annotated classes.
        Returns:
        returns all test classes that are annotated with DemoTest
      • getAllPerformanceTestClasses

        public java.util.Collection<java.lang.Class> getAllPerformanceTestClasses()
        This method resets all filters and scans for PerformanceTest annotated classes.
        Returns:
        returns all test classes that are annotated with PerformanceTest
      • getAllManualTestClasses

        public java.util.Collection<java.lang.Class> getAllManualTestClasses()
        This method resets all filters and scans for ManualTest annotated classes.
        Returns:
        returns all test classes that are annotated with ManualTest
      • getAllBugProofTestClasses

        public java.util.Collection<java.lang.Class> getAllBugProofTestClasses()
        This method resets all filters and scans for BugProofTest annotated classes.
        Returns:
        returns all test classes that are annotated with BugProofTest
      • addFilter

        public void addFilter​(TestClassesUtil.FILTER filter,
                              java.lang.Object filterValue)
        This method adds a filter to the scanning process. All filters can be deleted with the resetFilter method.
        Please add all filters before you finally invoke a getAllClasses() method!
        Parameters:
        filter - see TestClassesUtil.FILTER
        filterValue - The filterValue can either be an Object or a Collection of Objects. See description of TestClassesUtil.FILTER
      • resetFilter

        public void resetFilter()
        Clears all filters!
      • getFilteredTestClasses

        public java.util.Collection<java.lang.Class> getFilteredTestClasses()
        Returns all test classes according to the filters that are set. If no filters are set, the result equals to the getAllTestClasses() method!
        Returns:
        the filtered test classes
      • getWebModuleClasspaths

        public java.lang.String getWebModuleClasspaths()
      • getModuleClasspaths

        public java.lang.String getModuleClasspaths​(ExtensionModule... modules)
        Get classpaths for selected modules.
        Parameters:
        modules - List of modules to retrieve classpaths for.
        Returns:
        Comma-separated list of classpaths for the selected modules. If no classpaths exist for the given modules or if no modules were selected, null is returned.
      • matchesPackageFilters

        public boolean matchesPackageFilters​(java.lang.Class clazz)
      • setLogging

        public void setLogging​(boolean logging)
      • matchesPackageFilters

        public boolean matchesPackageFilters​(java.lang.String string)