- Direct Known Subclasses:
ImageIOTestCase
,NameTest
,ReferencingTestCase
,TransformTestCase
factories(Class[])
method.- Since:
- 2.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Configuration.Key<Boolean>
A tip set by subclasses during the execution of some optional tests.final TestWatcher
A JUnit rule for listening to test execution events.protected final Units
Provider of units of measurement (degree, metre, second, etc), nevernull
.protected final ValidatorContainer
The set ofValidator
instances to use for verifying objects conformance (nevernull
). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns information about the configuration of the test which has been run.Returns factory instances for given factory interfaces.protected final boolean[]
getEnabledFlags
(Configuration.Key<Boolean>... properties) Returns booleans indicating whether the given operations are enabled.
-
Field Details
-
listener
A JUnit rule for listening to test execution events. This rule forwards events to all registered listeners.This field is public because JUnit requires us to do so, but should be considered as an implementation details (it should have been a private field).
- Since:
- 3.1
-
units
Provider of units of measurement (degree, metre, second, etc), nevernull
. TheUnits.degree()
,metre()
and other methods shall returnUnit
instances compatible with the units created by theFactory
instances to be tested. ThoseUnit<?>
instances depend on the Unit of Measurement (JSR-373) implementation used by the factories. If no units were explicitly specified, then the default units are used.- Since:
- 3.1
-
validators
The set ofValidator
instances to use for verifying objects conformance (nevernull
). If no validators were explicitly specified, then the default validators are used.- Since:
- 3.1
-
configurationTip
A tip set by subclasses during the execution of some optional tests. In case of optional test failure, if this field is non-null, then a message will be logged at theLevel.INFO
for giving some tips to the developer about how he can disable the test.Example
@Test public void myTest() { if (isDerivativeSupported) { configurationTip = Configuration.Key.isDerivativeSupported; // Do some tests the require support of math transform derivatives. } configurationTip = null; }
- Since:
- 3.1
-
-
Constructor Details
-
TestCase
protected TestCase()Creates a new test without factory. This constructor is provided for subclasses that instantiate their test object directly, without using any factory. -
TestCase
Creates a new test which will use the given factories to execute.- Parameters:
factories
- the factories to be used by the test.- Since:
- 3.1
-
-
Method Details
-
factories
Returns factory instances for given factory interfaces. Each element in the returned list is the arguments to give to the subclass constructor. There is typically only one element in the list, but more elements could be included if many factory implementations are found for the same interface.This method is used by static methods having the
Parameterized.Parameters
annotation in subclasses. For example if a subclass constructor expects 3 factories of kindCRSFactory
,CSFactory
andDatumFactory
in that order, then that subclass contains the following method:@Parameterized.Parameters public static List<Factory[]> factories() { return factories(CRSFactory.class, CSFactory.class, DatumFactory.class); }
Assume
checks in order to disable any tests that require a missing factory.If many factory implementations were found for a given interface, then this method returns all possible combinations of those factories. For example if two instances of interface
A
are found (namedA1
andA2
), and two instances of interfaceB
are also found (namedB1
andB2
), then this method returns a list containing:
The current implementation first checks the factories explicitly specified by calls to the{A1, B1} {A2, B1} {A1, B2} {A2, B2}
TestSuite.setFactories(Class, Factory[])
method. In no factories were explicitly specified, then this method searches the classpath usingServiceLoader
.- Parameters:
types
- the kind of factories to fetch.- Returns:
- all combinations of factories of the given kind. Each list element is an array
having the same length than
types
. - Since:
- 3.1
- See Also:
-
getEnabledFlags
Returns booleans indicating whether the given operations are enabled. By default, every operations are enabled.- Parameters:
properties
- the key for which the flags are wanted.- Returns:
- an array of the same length than
properties
in which each element at index i indicates whether theproperties[i]
test should be enabled. - Since:
- 3.1
-
configuration
Returns information about the configuration of the test which has been run. The content of this map depends on theTestCase
subclass. For a description of the map content, see any of the following subclasses:- Returns:
- the configuration of the test being run, or an empty map if none. This method returns a modifiable map in order to allow subclasses to modify it.
- Since:
- 3.1
-