Class AuthorityFactoryTestCase<T>
- Object
-
- TestCase
-
- ReferencingTestCase
-
- AuthorityFactoryTestCase<T>
-
- Type Parameters:
T
- the type of objects to test.
- Direct Known Subclasses:
GIGS2001
,GIGS2002
,GIGS2003
,GIGS2004
,GIGS2005
,GIGS2006
,GIGS2007
,GIGS2008
,GIGS2009
public abstract class AuthorityFactoryTestCase<T> extends ReferencingTestCase
Base class for tests of EPSG definitions (2000 series). The tests for this series are designed to verify the correctness of geodetic parameters that are delivered with the software. The comparison to be taken as truth is the EPSG Dataset.- Since:
- 3.1
- See Also:
AuthorityFactoryTest
,TestSuite
-
-
Field Summary
Fields Modifier and Type Field Description String[]
aliases
The expected aliases of theT
instance to test, or an empty array if none.int
code
The EPSG code of theT
instance to test.protected boolean
isDependencyIdentificationSupported
true
if theIdentifiedObject
instances created indirectly by the factories are expected to have correct identification information.protected boolean
isDeprecatedObjectCreationSupported
true
if the factory support creation of deprecated objects.protected boolean
isStandardAliasSupported
true
if the tested factories support aliases.protected boolean
isStandardNameSupported
true
if the tested factories support name.String
name
The name of theT
instance to test, as used in the EPSG dataset.-
Fields inherited from class TestCase
configurationTip, listener, units, validators
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AuthorityFactoryTestCase(AuthorityFactory... factories)
Creates a new test which will use the given factories to execute.
-
Method Summary
Modifier and Type Method Description Configuration
configuration()
Returns information about the configuration of the test which has been run.abstract T
getIdentifiedObject()
Returns the instance to be tested.protected String
getVerifiableName(IdentifiedObject object)
Returns a name of the given object that can be compared against the expected name.-
Methods inherited from class ReferencingTestCase
verifyCoordinateSystem, verifyFlattenedSphere, verifyGeographicExtent, verifyIdentification, verifyParameter, verifyPrimeMeridian, verifyTimeExtent, verifyVerticalExtent
-
Methods inherited from class TestCase
factories, factories, getEnabledFlags
-
-
-
-
Field Detail
-
code
public int code
The EPSG code of theT
instance to test. This field is set by all test methods before to create and to verify theT
instance.This code can be compared to the identifiers returned by
IdentifiedObject.getIdentifiers()
.
-
name
public String name
The name of theT
instance to test, as used in the EPSG dataset. This field is set by all test methods before to create and to verify theT
instance.This name will be compared to the value returned by
IdentifiedObject.getName()
, unlessisStandardNameSupported
isfalse
.
-
aliases
public String[] aliases
The expected aliases of theT
instance to test, or an empty array if none. This field is set by all test methods before to create and to verify theT
instance.Those aliases will be compared to the values returned by
IdentifiedObject.getAlias()
, unlessisStandardAliasSupported
isfalse
.
-
isStandardNameSupported
protected boolean isStandardNameSupported
true
if the tested factories support name. Iftrue
(the default), then the test methods will ensure that the identified objects created by the factories declare the same name than the GIGS tests. Iffalse
, then the names are ignored.
-
isStandardAliasSupported
protected boolean isStandardAliasSupported
true
if the tested factories support aliases. Iftrue
(the default), then the test methods will ensure that the identified objects created by the factories declare at least all the aliases enumerated in the GIGS tests - additional aliases, if any, are ignored. Iffalse
, then the aliases are ignored.
-
isDependencyIdentificationSupported
protected boolean isDependencyIdentificationSupported
true
if theIdentifiedObject
instances created indirectly by the factories are expected to have correct identification information.Example: when testing aCoordinateReferenceSystem
(CRS) object, the CRS authority code will be verified unconditionally but the authority codes of associated objects (GeodeticDatum
orCoordinateSystem
) will be verified only if this flag istrue
.
-
isDeprecatedObjectCreationSupported
protected boolean isDeprecatedObjectCreationSupported
true
if the factory support creation of deprecated objects.
-
-
Constructor Detail
-
AuthorityFactoryTestCase
protected AuthorityFactoryTestCase(AuthorityFactory... factories)
Creates a new test which will use the given factories to execute.- Parameters:
factories
- the factories to be used by the test. Those factories passed verbatim to the super-class constructor.
-
-
Method Detail
-
configuration
public Configuration configuration()
Returns information about the configuration of the test which has been run. This method returns a map containing:- All the following values associated to the
Configuration.Key
of the same name:isStandardNameSupported
isStandardAliasSupported
isDependencyIdentificationSupported
- The factories used by the test (provided by subclasses)
- Overrides:
configuration
in classTestCase
- Returns:
- the configuration of the test being run.
- See Also:
ImplementationDetails.configuration(Factory[])
- All the following values associated to the
-
getIdentifiedObject
public abstract T getIdentifiedObject() throws FactoryException
Returns the instance to be tested. When this method is invoked for the first time, it creates the instance to test by invoking acreateXXX(String)
method from the user-specifiedAuthorityFactory
with the currentcode
value in argument. The created object is then cached and returned in subsequent invocations of this method.Usually, each test method creates exactly one object. But a few (relatively rare) tests may create more than one object. In such case, the instance returned by this method may vary.
- Returns:
- the instance to test.
- Throws:
FactoryException
- if an error occurred while creating the identified object.
-
getVerifiableName
protected String getVerifiableName(IdentifiedObject object)
Returns a name of the given object that can be compared against the expected name. The default implementation returnsobject.getName().getCode()
ornull
if the given object, its name or its code is null.Subclasses can override this method when testing an
AuthorityFactory
implementation which is known to use slightly different name than the one used in the EPSG database, or if the implementation stores the EPSG name as an alias instead than as the primary name.Example: if an implementation replaces all spaces by underscores, then a subclass testing that implementation could override this method as below:Note that if the object names are too different for being compared, then subclasses can also disable name comparisons by setting@Override protected String getVerifiableName(IdentifiedObject object) { return super.getVerifiableName().replace(' ', '_'); }
isStandardNameSupported
tofalse
.- Parameters:
object
- the object from which to get a name than can be verified against the expected name.- Returns:
- the name of the given object, eventually modified in order to match the expected name.
- See Also:
isStandardNameSupported
,isStandardAliasSupported
-
-