Class GIGS2001
- Object
-
- TestCase
-
- ReferencingTestCase
-
- AuthorityFactoryTestCase<Unit<?>>
-
- GIGS2001
-
public class GIGS2001 extends AuthorityFactoryTestCase<Unit<?>>
Verifies reference units of measure bundled with the geoscience software.Test method: Compare unit definitions included in the software against the EPSG Dataset. Test data: GIGS_2001_libUnit.csv
and EPSG Dataset. Contains EPSG code and name for the unit of measure, together with the ratio of the unit to the ISO base unit for that unit type. The test methods are separated in three blocks for linear units, angular units and scaling units.Tested API: CSAuthorityFactory.createUnit(String)
.Expected result: Unit of measure definitions bundled with software should have the ratio to the appropriate base unit as in the EPSG Dataset. The values of the base unit per unit should be correct to at least 10 significant figures. Units missing from the software or at variance with those in the EPSG Dataset should be reported. Usage example: in order to specify their factories and run the tests in a JUnit framework, implementors can define a subclass in their own test suite as in the example below:import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.opengis.test.referencing.gigs.GIGS2001; @RunWith(JUnit4.class) public class MyTest extends GIGS2001 { public MyTest() { super(new MyCSAuthorityFactory()); } }
- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description Unit<?>
baseUnit
The base unit of the unit to create.protected CSAuthorityFactory
csAuthorityFactory
Factory to use for buildingUnit
instances, ornull
if none.double
unitToBase
Amount of base units in one tested unit.-
Fields inherited from class AuthorityFactoryTestCase
aliases, code, isDependencyIdentificationSupported, isDeprecatedObjectCreationSupported, isStandardAliasSupported, isStandardNameSupported, name
-
Fields inherited from class TestCase
configurationTip, listener, units, validators
-
-
Constructor Summary
Constructors Constructor Description GIGS2001(CSAuthorityFactory csFactory)
Creates a new test using the given factory.
-
Method Summary
Modifier and Type Method Description Configuration
configuration()
Returns information about the configuration of the test which has been run.static List<Factory[]>
factories()
Returns a default set of factories to use for running the tests.Unit<?>
getIdentifiedObject()
Returns the unit instance to be tested.void
testArcSecond()
Tests “arc-second” unit creation from the factory.void
testBritishChain()
Tests “British chain (Sears 1922)” unit creation from the factory.void
testBritishChainTruncated()
Tests “British chain (Sears 1922 truncated)” unit creation from the factory.void
testBritishFoot()
Tests “British foot (Sears 1922)” unit creation from the factory.void
testBritishYard()
Tests “British yard (Sears 1922)” unit creation from the factory.void
testCentesimalSecond()
Tests “centesimal second” unit creation from the factory.void
testClarkeFoot()
Tests “Clarke's foot” unit creation from the factory.void
testClarkeLink()
Tests “Clarke's link” unit creation from the factory.void
testCoefficient()
Tests “coefficient” unit creation from the factory.void
testDegree()
Tests “degree” unit creation from the factory.void
testFoot()
Tests “foot” unit creation from the factory.void
testGermanLegalMetre()
Tests “German legal metre” unit creation from the factory.void
testGoldCoastFoot()
Tests “Gold Coast foot” unit creation from the factory.void
testGrad()
Tests “grad” unit creation from the factory.void
testIndianYard()
Tests “Indian yard” unit creation from the factory.void
testKilometre()
Tests “kilometre” unit creation from the factory.void
testLink()
Tests “link” unit creation from the factory.void
testMetre()
Tests “metre” unit creation from the factory.void
testMicroRadian()
Tests “microradian” unit creation from the factory.void
testPartsPerMillion()
Tests “parts per million” unit creation from the factory.void
testRadian()
Tests “radian” unit creation from the factory.void
testSexagesimalDegree()
Tests “sexagesimal DMS” unit creation from the factory.void
testUnity()
Tests “unity” unit creation from the factory.void
testUSSurveyFoot()
Tests “US survey foot” unit creation from the factory.-
Methods inherited from class AuthorityFactoryTestCase
getVerifiableName
-
Methods inherited from class ReferencingTestCase
verifyCoordinateSystem, verifyFlattenedSphere, verifyGeographicExtent, verifyIdentification, verifyParameter, verifyPrimeMeridian, verifyTimeExtent, verifyVerticalExtent
-
Methods inherited from class TestCase
factories, factories, getEnabledFlags
-
-
-
-
Field Detail
-
unitToBase
public double unitToBase
Amount of base units in one tested unit. If this amount is not a constant (as in sexagesimal unit), then this factor is set toDouble.NaN
.
-
baseUnit
public Unit<?> baseUnit
The base unit of the unit to create. This field will have one of the following values:Units.metre()
if the unit to create is linear,Units.radian()
if the unit to create is angular (except sexagesimal unit),Units.one()
if the unit to create is a scale or a coefficient, or- (exceptionally)
Units.degree()
in the special case oftestSexagesimalDegree()
. Note that sexagesimal units also have the ratio of the unit to base unit set toDouble.NaN
.
-
csAuthorityFactory
protected final CSAuthorityFactory csAuthorityFactory
Factory to use for buildingUnit
instances, ornull
if none. This is the factory used by thegetIdentifiedObject()
method.
-
-
Constructor Detail
-
GIGS2001
public GIGS2001(CSAuthorityFactory csFactory)
Creates a new test using the given factory. If a given factory isnull
, then the tests which depend on it will be skipped.- Parameters:
csFactory
- factory for creatingUnit
instances.
-
-
Method Detail
-
factories
public static List<Factory[]> factories()
Returns a default set of factories to use for running the tests. Those factories are given in arguments to the constructor when this test class is instantiated directly by JUnit (for example as a suite element), instead than subclassed by the implementor. The factories are fetched as documented in theTestCase.factories(Class[])
javadoc.- Returns:
- the default set of arguments to be given to the
GIGS2001
constructor.
-
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:
- Overrides:
configuration
in classAuthorityFactoryTestCase<Unit<?>>
- Returns:
- the configuration of the test being run.
- See Also:
ImplementationDetails.configuration(Factory[])
- All the following values associated to the
-
getIdentifiedObject
public Unit<?> getIdentifiedObject() throws FactoryException
Returns the unit instance to be tested. When this method is invoked for the first time, it creates the unit to test by invoking theCSAuthorityFactory.createUnit(String)
method with the currentAuthorityFactoryTestCase.code
value in argument. The created object is then cached and returned in all subsequent invocations of this method.- Specified by:
getIdentifiedObject
in classAuthorityFactoryTestCase<Unit<?>>
- Returns:
- the unit instance to test.
- Throws:
FactoryException
- if an error occurred while creating the unit instance.
-
testMetre
public void testMetre() throws FactoryException
Tests “metre” unit creation from the factory.- EPSG UoM code: 9001
- Type: Linear
- Name of Units used in EPSG dataset: metre
- Base units per unit: 1
- Specific usage / Remarks: Numerous
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testKilometre
public void testKilometre() throws FactoryException
Tests “kilometre” unit creation from the factory.- EPSG UoM code: 9036
- Type: Linear
- Name of Units used in EPSG dataset: kilometre
- Base units per unit: 1000
- Specific usage / Remarks: Tunisia
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testFoot
public void testFoot() throws FactoryException
Tests “foot” unit creation from the factory.- EPSG UoM code: 9002
- Type: Linear
- Name of Units used in EPSG dataset: foot
- Base units per unit: 0.3048
- Specific usage / Remarks: US
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testUSSurveyFoot
public void testUSSurveyFoot() throws FactoryException
Tests “US survey foot” unit creation from the factory.- EPSG UoM code: 9003
- Type: Linear
- Name of Units used in EPSG dataset: US survey foot
- Base units per unit: 0.30480060960121924
- Specific usage / Remarks: US
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testGermanLegalMetre
public void testGermanLegalMetre() throws FactoryException
Tests “German legal metre” unit creation from the factory.- EPSG UoM code: 9031
- Type: Linear
- Name of Units used in EPSG dataset: German legal metre
- Base units per unit: 1.0000135965
- Specific usage / Remarks: Namibia
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testClarkeFoot
public void testClarkeFoot() throws FactoryException
Tests “Clarke's foot” unit creation from the factory.- EPSG UoM code: 9005
- Type: Linear
- Name of Units used in EPSG dataset: Clarke's foot
- Base units per unit: 0.3047972654
- Specific usage / Remarks: Trinidad
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testClarkeLink
public void testClarkeLink() throws FactoryException
Tests “Clarke's link” unit creation from the factory.- EPSG UoM code: 9039
- Type: Linear
- Name of Units used in EPSG dataset: Clarke's link
- Base units per unit: 0.201166195164
- Specific usage / Remarks: Trinidad
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testBritishChain
public void testBritishChain() throws FactoryException
Tests “British chain (Sears 1922)” unit creation from the factory.- EPSG UoM code: 9042
- Type: Linear
- Name of Units used in EPSG dataset: British chain (Sears 1922)
- Base units per unit: 20.116765121552632
- Specific usage / Remarks: Brunei Malaysia
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.- See Also:
testBritishChainTruncated()
-
testBritishFoot
public void testBritishFoot() throws FactoryException
Tests “British foot (Sears 1922)” unit creation from the factory.- EPSG UoM code: 9051
- Type: Linear
- Name of Units used in EPSG dataset: British foot (Sears 1922)
- Base units per unit: 0.3047997333333333
- Specific usage / Remarks: Brunei Malaysia
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testBritishYard
public void testBritishYard() throws FactoryException
Tests “British yard (Sears 1922)” unit creation from the factory.- EPSG UoM code: 9040
- Type: Linear
- Name of Units used in EPSG dataset: British yard (Sears 1922)
- Base units per unit: 0.9143984146160287
- Specific usage / Remarks: New Zealand
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testBritishChainTruncated
public void testBritishChainTruncated() throws FactoryException
Tests “British chain (Sears 1922 truncated)” unit creation from the factory.- EPSG UoM code: 9301
- Type: Linear
- Name of Units used in EPSG dataset: British chain (Sears 1922 truncated)
- Base units per unit: 20.116756
- Specific usage / Remarks: Malaysia
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.- See Also:
testBritishChain()
-
testIndianYard
public void testIndianYard() throws FactoryException
Tests “Indian yard” unit creation from the factory.- EPSG UoM code: 9084
- Type: Linear
- Name of Units used in EPSG dataset: Indian yard
- Base units per unit: 0.9143985307444408
- Specific usage / Remarks: south Asia - historic
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testGoldCoastFoot
public void testGoldCoastFoot() throws FactoryException
Tests “Gold Coast foot” unit creation from the factory.- EPSG UoM code: 9094
- Type: Linear
- Name of Units used in EPSG dataset: Gold Coast foot
- Base units per unit: 0.3047997101815088
- Specific usage / Remarks: Ghana
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testLink
public void testLink() throws FactoryException
Tests “link” unit creation from the factory.- EPSG UoM code: 9098
- Type: Linear
- Name of Units used in EPSG dataset: link
- Base units per unit: 0.201168
- Specific usage / Remarks: Fiji
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testRadian
public void testRadian() throws FactoryException
Tests “radian” unit creation from the factory.- EPSG UoM code: 9101
- Type: Angle
- Name of Units used in EPSG dataset: radian
- Base units per unit: 1.0
- Specific usage / Remarks: Some geocentric 7- and 10-parameter transformations for Colombia and US/Canada.
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testDegree
public void testDegree() throws FactoryException
Tests “degree” unit creation from the factory.- EPSG UoM code: 9102
- Type: Angle
- Name of Units used in EPSG dataset: degree
- Base units per unit: 0.017453292519943278
- Specific usage / Remarks: Numerous
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testArcSecond
public void testArcSecond() throws FactoryException
Tests “arc-second” unit creation from the factory.- EPSG UoM code: 9104
- Type: Angle
- Name of Units used in EPSG dataset: arc-second
- Base units per unit: 4.848136811095355E-6
- Specific usage / Remarks: Numerous
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testGrad
public void testGrad() throws FactoryException
Tests “grad” unit creation from the factory.- EPSG UoM code: 9105
- Type: Angle
- Name of Units used in EPSG dataset: grad
- Base units per unit: 0.01570796326794895
- Specific usage / Remarks: France
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testMicroRadian
public void testMicroRadian() throws FactoryException
Tests “microradian” unit creation from the factory.- EPSG UoM code: 9109
- Type: Angle
- Name of Units used in EPSG dataset: microradian
- Base units per unit: 1E-6
- Specific usage / Remarks: Some 7- and 10-parameter transformations for Netherlands and Norway.
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testSexagesimalDegree
public void testSexagesimalDegree() throws FactoryException
Tests “sexagesimal DMS” unit creation from the factory.- EPSG UoM code: 9110
- Type: Angle
- Name of Units used in EPSG dataset: sexagesimal DMS
- Base units per unit: not a constant
- Specific usage / Remarks: Special EPSG construct for storing sexagesimal degree values as a single real number. Applications do not necessarily have to adopt this approach but should somehow exactly honour sexagesimal value. Sexagesimal degree (123º45'67.8"[H]) should be used for display at human interface.
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testCentesimalSecond
public void testCentesimalSecond() throws FactoryException
Tests “centesimal second” unit creation from the factory.- EPSG UoM code: 9113
- Type: Angle
- Name of Units used in EPSG dataset: centesimal second
- Base units per unit: 1.570796326794895E-6
- Specific usage / Remarks: Used in one geocentric 7-parameter transformation for Switzerland.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testUnity
public void testUnity() throws FactoryException
Tests “unity” unit creation from the factory.- EPSG UoM code: 9201
- Type: Scale
- Name of Units used in EPSG dataset: unity
- Base units per unit: 1.0
- Specific usage / Remarks: Numerous
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testPartsPerMillion
public void testPartsPerMillion() throws FactoryException
Tests “parts per million” unit creation from the factory.- EPSG UoM code: 9202
- Type: Scale
- Name of Units used in EPSG dataset: parts per million
- Base units per unit: 1E-6
- Specific usage / Remarks: Numerous
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
testCoefficient
public void testCoefficient() throws FactoryException
Tests “coefficient” unit creation from the factory.- EPSG UoM code: 9203
- Type: Scale
- Name of Units used in EPSG dataset: coefficient
- Base units per unit: 1.0
- Specific usage / Remarks: Numerous
- Particularly important to E&P industry.
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
-