Object
TestSuite
The suite of every tests defined in the GeoAPI conformance module.
The test cases included in this test suite are:
NameTest
ObjectFactoryTest
AffineTransformTest
ParameterizedTransformTest
AuthorityFactoryTest
CRSParserTest
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 useFactory
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.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor provided for allowing subclassing. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addTestListener
(TestListener listener) Deprecated.To be replaced by JUnit 5 listener mechanism.static void
clear()
Clears all factories specified to thesetFactories(Class, Factory[])
method, and clears all service loader caches.static <T extends Factory>
T[]getFactories
(Class<T> type) Returns the factory implementations explicitly given by the last call tosetFactories(Class, Factory[])
for the given interface.static void
removeTestListener
(TestListener listener) Deprecated.To be replaced by JUnit 5 listener mechanism.static void
setClassLoader
(ClassLoader loader) Sets the class loader to use for loading implementations.static <T extends Factory>
voidsetFactories
(Class<T> type, T... factory) Specifies the factory implementations to use for the given factory interface.
-
Constructor Details
-
TestSuite
protected TestSuite()Constructor provided for allowing subclassing. Instances of this class usually don't need to be created.
-
-
Method Details
-
setClassLoader
Sets the class loader to use for loading implementations. Anull
value restores the default context class loader.- Parameters:
loader
- the class loader to use, ornull
for the default.
-
setFactories
Specifies the factory implementations to use for the given factory interface.- Type Parameters:
T
- the compile-time type of thetype
class argument.- Parameters:
type
- the factory interface for which an implementation is specified.factory
- the implementations to use for the given interface.
-
getFactories
Returns the factory implementations explicitly given by the last call tosetFactories(Class, Factory[])
for the given interface. This method does not iterate onServiceLoader
entries.- Type Parameters:
T
- the compile-time type of thetype
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
Deprecated.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).- Parameters:
listener
- The listener to add.null
values are silently ignored.
-
removeTestListener
Deprecated.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.- Parameters:
listener
- the listener to remove.null
values are silently ignored.
-
clear
public static void clear()Clears all factories specified to thesetFactories(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:
-