Object
IntegrityTest
Series2000<Unit<?>>
Test2201
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_lib_2201_Unit.txt
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, implementers can define a subclass in their own test suite as in the example below:public class MyTest extends Test2201 {
public MyTest() {
super(new MyCSAuthorityFactory());
}
}
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionUnit<?>
The base unit of the unit to create.protected final CSAuthorityFactory
Factory to use for buildingUnit
instances, ornull
if none.double
Amount of base units in one tested unit. -
Constructor Summary
ConstructorsConstructorDescriptionTest2201
(CSAuthorityFactory csFactory) Creates a new test using the given factory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Tests “metre” unit creation from the factory.void
Tests “foot” unit creation from the factory.void
Tests “US survey foot” unit creation from the factory.void
Tests “Clarke's foot” unit creation from the factory.void
Tests “German legal metre” unit creation from the factory.void
Tests “kilometre” unit creation from the factory.void
Tests “Clarke's link” unit creation from the factory.void
Tests “British yard (Sears 1922)” unit creation from the factory.void
Tests “British foot (Sears 1922)” unit creation from the factory.void
Tests “British chain (Sears 1922)” unit creation from the factory.void
Tests “Indian yard” unit creation from the factory.void
Tests “Gold Coast foot” unit creation from the factory.void
Tests “link” unit creation from the factory.void
Tests “radian” unit creation from the factory.void
Tests “degree” unit creation from the factory.void
Tests “arc-second” unit creation from the factory.void
Tests “grad” unit creation from the factory.void
Tests “microradian” unit creation from the factory.void
Tests “sexagesimal DMS” unit creation from the factory.void
Tests “centesimal second” unit creation from the factory.void
Tests “unity” unit creation from the factory.void
Tests “parts per million” unit creation from the factory.void
Tests “coefficient” unit creation from the factory.void
Tests “British chain (Sears 1922 truncated)” unit creation from the factory.Unit<?>
Returns the unit instance to be tested.Methods inherited from class Series2000
getVerifiableName
-
Field Details
-
unitToBase
public double unitToBaseAmount 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
. This field is set by all test methods before to create and verify theUnit
instance. -
baseUnit
public Unit<?> baseUnitThe 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 ofEPSG_9110()
. Note that sexagesimal units also have the ratio of the unit to base unit set toDouble.NaN
.
Unit
instance. -
csAuthorityFactory
Factory to use for buildingUnit
instances, ornull
if none. This is the factory used by thegetIdentifiedObject()
method.
-
-
Constructor Details
-
Test2201
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 Details
-
getIdentifiedObject
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 currentSeries2000.code
value in argument. The created object is then cached and returned in all subsequent invocations of this method.- Specified by:
getIdentifiedObject
in classSeries2000<Unit<?>>
- Returns:
- the unit instance to test.
- Throws:
FactoryException
- if an error occurred while creating the unit instance.
-
EPSG_9104
Tests “arc-second” unit creation from the factory.- EPSG UoM code: 9104
- Type: Angle
- Name of Units used in EPSG dataset: arc-second
- Alias(es) given by EPSG: sec, angular second
- Base units per unit: 3.14159265358979 / 648000 ≈ 4.8481368111E-6
- Base units per unit description: radians per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9042
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)
- Alias(es) given by EPSG: chain, chSe
- Base units per unit: 792 / 39.370147 ≈ 20.1167651215526
- Base units per unit description: metres per unit
- EPSG Usage Extent: East Malaysia; New Zealand
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9301
@Test @DisplayName("British chain (Sears 1922 truncated)") public void EPSG_9301() throws FactoryExceptionTests “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)
- Alias(es) given by EPSG: chain, chSe(T)
- Base units per unit: 20.116756
- Base units per unit description: metres per unit
- EPSG Usage Extent: Malaysia
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9041
Tests “British foot (Sears 1922)” unit creation from the factory.- EPSG UoM code: 9041
- Type: Linear
- Name of Units used in EPSG dataset: British foot (Sears 1922)
- Alias(es) given by EPSG: foot, ftSe
- Base units per unit: 12 / 39.370147 ≈ 0.304799471538676
- Base units per unit description: metres per unit
- EPSG Usage Extent: East Malaysia; New Zealand
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9040
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)
- Alias(es) given by EPSG: yard, ydSe
- Base units per unit: 36 / 39.370147 ≈ 0.914398414616029
- Base units per unit description: metres per unit
- EPSG Usage Extent: East Malaysia; New Zealand
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9113
Tests “centesimal second” unit creation from the factory.- EPSG UoM code: 9113
- Type: Angle
- Name of Units used in EPSG dataset: centesimal second
- Alias(es) given by EPSG: cc, centesimal-second
- Base units per unit: 3.14159265358979 / 2000000 ≈ 1.5707963268E-6
- Base units per unit description: radians per unit
- EPSG Usage Extent: Switzerland
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9005
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
- Alias(es) given by EPSG: South African geodetic foot, ftCla, Clarke foot
- Base units per unit: 0.3047972654
- Base units per unit description: metres per unit
- EPSG Usage Extent: Australia; South Africa; British West Indies
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9039
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
- Alias(es) given by EPSG: link (Clarke's ratio), lkCla, Clarke link
- Base units per unit: 0.201166195164
- Base units per unit description: metres per unit
- EPSG Usage Extent: Australia; South Africa; British West Indies
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9203
Tests “coefficient” unit creation from the factory.- EPSG UoM code: 9203
- Type: Scale
- Name of Units used in EPSG dataset: coefficient
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9102
Tests “degree” unit creation from the factory.- EPSG UoM code: 9102
- Type: Angle
- Name of Units used in EPSG dataset: degree
- Alias(es) given by EPSG: deg, angular degree
- Base units per unit: 3.14159265358979 / 180 ≈ 0.017453293
- Base units per unit description: radians per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9002
Tests “foot” unit creation from the factory.- EPSG UoM code: 9002
- Type: Linear
- Name of Units used in EPSG dataset: foot
- Alias(es) given by EPSG: international foot, ft
- Base units per unit: 0.3048
- Base units per unit description: metres per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9031
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
- Alias(es) given by EPSG: GLM
- Base units per unit: 1.0000135965
- Base units per unit description: metres per unit
- EPSG Usage Extent: Namibia
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9094
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
- Alias(es) given by EPSG: foot, ftGC
- Base units per unit: 6378300 / 20926201 ≈ 0.304799710181509
- Base units per unit description: metres per unit
- EPSG Usage Extent: Ghana
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9105
Tests “grad” unit creation from the factory.- EPSG UoM code: 9105
- Type: Angle
- Name of Units used in EPSG dataset: grad
- Alias(es) given by EPSG: gr, gon
- Base units per unit: 3.14159265358979 / 200 ≈ 0.0157079632679489
- Base units per unit description: radians per unit
- EPSG Usage Extent: France
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9084
Tests “Indian yard” unit creation from the factory.- EPSG UoM code: 9084
- Type: Linear
- Name of Units used in EPSG dataset: Indian yard
- Alias(es) given by EPSG: yard, ydInd
- Base units per unit: 36 / 39.370142 ≈ 0.914398530744441
- Base units per unit description: metres per unit
- EPSG Usage Extent: South Asia
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9036
Tests “kilometre” unit creation from the factory.- EPSG UoM code: 9036
- Type: Linear
- Name of Units used in EPSG dataset: kilometre
- Alias(es) given by EPSG: kilometer, km
- Base units per unit: 1000
- Base units per unit description: metres per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9098
Tests “link” unit creation from the factory.- EPSG UoM code: 9098
- Type: Linear
- Name of Units used in EPSG dataset: link
- Alias(es) given by EPSG: international link, lk
- Base units per unit: 20.1168 / 100 ≈ 0.201168
- Base units per unit description: metres per unit
- EPSG Usage Extent: Fiji
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9001
Tests “metre” unit creation from the factory.- EPSG UoM code: 9001
- Type: Linear
- Name of Units used in EPSG dataset: metre
- Alias(es) given by EPSG: meter, International metre, m
- Base units per unit: 1
- Base units per unit description: metres per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9109
Tests “microradian” unit creation from the factory.- EPSG UoM code: 9109
- Type: Angle
- Name of Units used in EPSG dataset: microradian
- Alias(es) given by EPSG: µrad
- Base units per unit: 1 / 1000000 ≈ 1.0E-6
- Base units per unit description: radians per unit
- EPSG Usage Extent: Netherlands; Norway
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9202
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
- Alias(es) given by EPSG: ppm, µm/m
- Base units per unit: 1 / 1000000 ≈ 1.0E-6
- Base units per unit description: parts per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9101
Tests “radian” unit creation from the factory.- EPSG UoM code: 9101
- Type: Angle
- Name of Units used in EPSG dataset: radian
- Alias(es) given by EPSG: rad
- Base units per unit: 1
- Base units per unit description: radians per unit
- EPSG Usage Extent: Colombia; USA; Canada
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9110
Tests “sexagesimal DMS” unit creation from the factory.- EPSG UoM code: 9110
- Type: Angle
- Name of Units used in EPSG dataset: sexagesimal DMS
- Alias(es) given by EPSG: DDD.MMSSsss, sexagesimal degree DDD.MMSSsss
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9201
Tests “unity” unit creation from the factory.- EPSG UoM code: 9201
- Type: Scale
- Name of Units used in EPSG dataset: unity
- Alias(es) given by EPSG: euclid
- Base units per unit: 1
- Base units per unit description: parts per unit
- EPSG Usage Extent: Numerous
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-
EPSG_9003
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
- Alias(es) given by EPSG: American foot, ftUS, ft(US)
- Base units per unit: 12 / 39.37 ≈ 0.304800609601219
- Base units per unit description: metres per unit
- EPSG Usage Extent: USA
- Throws:
FactoryException
- if an error occurred while creating the unit from the EPSG code.
-