Class TestSuite


public class TestSuite extends Object
The suite of every tests defined in the GeoAPI conformance module. The test cases included in this test suite are: This TestSuite class provides also some static methods for specifying explicitly which factories to use or being notified of test results. Those methods take effect even if the TestCase are run outside of a TestSuite context.

How implementations are discovered

All tests use Factory instances that are specific to the implementation being tested. By default TestSuite fetches the factory implementations with ServiceLoader, which will iterate every provides org.opengis.TheFactory statements in module-info files. However, implementers can override this default mechanism with explicit calls to the setFactories(Class, Factory[]) method.
See Also:
  • Constructor Details

    • TestSuite

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

    • 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.
      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.
      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 explicitly given by the last call to setFactories(Class, Factory[]) for the given interface. This method does not iterate on ServiceLoader entries.
      Type Parameters:
      T - the compile-time type of the type class argument.
      type - the factory interface for which an implementations is desired.
      the implementations for the given interface, or null if none.
    • addTestListener

      @Deprecated public static void addTestListener(TestListener listener)
      To be replaced by JUnit 5 listener mechanism.
      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).
      listener - The listener to add. null values are silently ignored.
    • removeTestListener

      @Deprecated public static void removeTestListener(TestListener listener)
      To be replaced by JUnit 5 listener mechanism.
      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.
      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: