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[]aliasesThe expected aliases of theTinstance to test, or an empty array if none.intcodeThe EPSG code of theTinstance to test.protected booleanisDependencyIdentificationSupportedtrueif theIdentifiedObjectinstances created indirectly by the factories are expected to have correct identification information.protected booleanisDeprecatedObjectCreationSupportedtrueif the factory support creation of deprecated objects.protected booleanisStandardAliasSupportedtrueif the tested factories support aliases.protected booleanisStandardNameSupportedtrueif the tested factories support name.StringnameThe name of theTinstance to test, as used in the EPSG dataset.-
Fields inherited from class TestCase
configurationTip, listener, units, validators
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAuthorityFactoryTestCase(AuthorityFactory... factories)Creates a new test which will use the given factories to execute.
-
Method Summary
Modifier and Type Method Description Configurationconfiguration()Returns information about the configuration of the test which has been run.abstract TgetIdentifiedObject()Returns the instance to be tested.protected StringgetVerifiableName(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 theTinstance to test. This field is set by all test methods before to create and to verify theTinstance.This code can be compared to the identifiers returned by
IdentifiedObject.getIdentifiers().
-
name
public String name
The name of theTinstance to test, as used in the EPSG dataset. This field is set by all test methods before to create and to verify theTinstance.This name will be compared to the value returned by
IdentifiedObject.getName(), unlessisStandardNameSupportedisfalse.
-
aliases
public String[] aliases
The expected aliases of theTinstance to test, or an empty array if none. This field is set by all test methods before to create and to verify theTinstance.Those aliases will be compared to the values returned by
IdentifiedObject.getAlias(), unlessisStandardAliasSupportedisfalse.
-
isStandardNameSupported
protected boolean isStandardNameSupported
trueif 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
trueif 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
trueif theIdentifiedObjectinstances 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 (GeodeticDatumorCoordinateSystem) will be verified only if this flag istrue.
-
isDeprecatedObjectCreationSupported
protected boolean isDeprecatedObjectCreationSupported
trueif 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.Keyof the same name:isStandardNameSupportedisStandardAliasSupportedisDependencyIdentificationSupported- The factories used by the test (provided by subclasses)
- Overrides:
configurationin 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-specifiedAuthorityFactorywith the currentcodevalue 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()ornullif the given object, its name or its code is null.Subclasses can override this method when testing an
AuthorityFactoryimplementation 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(' ', '_'); }isStandardNameSupportedtofalse.- 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
-
-