Class TestSuite

    • Constructor Detail

      • TestSuite

        protected TestSuite()
        Constructor provided for allowing subclassing. Instances of this class usually don't need to be created.
    • Method Detail

      • setClassLoader

        public static void setClassLoader​(ClassLoader loader)
        Sets the class loader to use for loading implementations. A null value restores the default context class loader.
        Parameters:
        loader - the class loader to use, or null for the default.
      • setFactories

        @SafeVarargs
        public static <T extends Factory> void setFactories​(Class<T> type,
                                                            T... factory)
        Specifies the factory implementations to use for the given factory interface.
        Type Parameters:
        T - the compile-time type of the type class argument.
        Parameters:
        type - the factory interface for which an implementation is specified.
        factory - the implementations to use for the given interface.
      • getFactories

        public static <T extends Factory> T[] getFactories​(Class<T> type)
        Returns the factory implementations explicitely given by the last call to setFactories(Class, Factory[]) for the given interface. This method does not scan the META-INF/services/<T> entries.
        Type Parameters:
        T - the compile-time type of the type class argument.
        Parameters:
        type - the factory interface for which an implementations is desired.
        Returns:
        the implementations for the given interface, or null if none.
      • addTestListener

        public static void addTestListener​(TestListener listener)
        Adds a listener to be informed every time a test begin or finish, either on success or failure. This method does not check if the given listener was already registered (i.e. the same listener may be added more than once).
        Parameters:
        listener - The listener to add. null values are silently ignored.
      • removeTestListener

        public static void removeTestListener​(TestListener listener)
        Removes a previously added listener. If the given listener has been added more than once, then only the last occurrence is removed. If the given listener is not found, then this method does nothing.
        Parameters:
        listener - the listener to remove. null values are silently ignored.
      • clear

        public static void clear()
        Clears all factories specified to the setFactories(Class, Factory[]) method, and clears all service loader caches. After this method call, all factories will be reloaded when first needed. This method is intended for use in situations in which new factories can be installed or removed into a running Java virtual machine.
        See Also:
        ServiceLoader.reload()