Package org.opengis.test.util
Class NameTest
-
public class NameTest extends TestCase
Tests generic name and related objects from theorg.opengis.util
package. Name instances are created using aNameFactory
given at construction time.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.util.NameTest; @RunWith(JUnit4.class) public class MyTest extends NameTest { public MyTest() { super(new MyNameFactory()); } }
- Since:
- 2.2
- See Also:
TestSuite
-
-
Field Summary
Fields Modifier and Type Field Description protected NameFactory
factory
The factory to be used for testing generic name instances, ornull
if none.protected boolean
isMixedNameSyntaxSupported
true
if theGenericName
implementations created by the factory can use different syntax rules in different part of their name.protected boolean
isMultiLocaleSupported
true
if theInternationalString
implementations created by the factory can support more than one locale.-
Fields inherited from class TestCase
configurationTip, listener, units, validators
-
-
Constructor Summary
Constructors Constructor Description NameTest(NameFactory factory)
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.void
testInternationalString()
Tests the creation of "My documents" folder name.void
testLocalName()
Tests the creation of"EPSG:4326"
as local names.void
testParsedHTTP()
Tests the parsing of"http://www.opengis.net/gml/srs/epsg.xml#4326"
as a local name.void
testParsedURN()
Tests the parsing of"urn:ogc:def:crs:epsg:4326"
as a scoped name.void
testScopedName()
Tests the creation of"urn:ogc:def:crs:epsg:4326"
as a scoped name.-
Methods inherited from class TestCase
factories, factories, getEnabledFlags
-
-
-
-
Field Detail
-
factory
protected final NameFactory factory
The factory to be used for testing generic name instances, ornull
if none.
-
isMultiLocaleSupported
protected boolean isMultiLocaleSupported
true
if theInternationalString
implementations created by the factory can support more than one locale. Iffalse
, then the factory method may retain only one locale among the set of user-provided localized strings.
-
isMixedNameSyntaxSupported
protected boolean isMixedNameSyntaxSupported
true
if theGenericName
implementations created by the factory can use different syntax rules in different part of their name.- If
true
, then URI using different separators in different parts of their name are supported.Example:":"
,"."
,"/"
and"#"
in"http://www.opengis.net/gml/srs/epsg.xml#4326"
. - If
false
, then only a single rule can be applied to the name as a whole.Example: only the":"
separator is used in"urn:ogc:def:crs:epsg:4326"
.
- If
-
-
Constructor Detail
-
NameTest
public NameTest(NameFactory factory)
Creates a new test using the given factory. If the given factory isnull
, then the tests will be skipped.- Parameters:
factory
- the factory to be used for creation of instances to be tested.
-
-
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
NameTest
constructor. - Since:
- 3.1
-
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 classTestCase
- 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.
- See Also:
ImplementationDetails.configuration(Factory[])
- All the following values associated to the
-
testInternationalString
public void testInternationalString()
Tests the creation of "My documents" folder name. This test uses the following factory methods:
-
testLocalName
public void testLocalName()
Tests the creation of"EPSG:4326"
as local names. First the"EPSG"
namespace is created. Then a"4326"
local name is created in that namespace. This test uses the following factory methods:
-
testScopedName
public void testScopedName()
Tests the creation of"urn:ogc:def:crs:epsg:4326"
as a scoped name. This test uses the following factory methods:
-
testParsedURN
public void testParsedURN()
Tests the parsing of"urn:ogc:def:crs:epsg:4326"
as a scoped name. This test uses the following factory methods:
-
testParsedHTTP
public void testParsedHTTP()
Tests the parsing of"http://www.opengis.net/gml/srs/epsg.xml#4326"
as a local name. This test uses the following factory methods:NameFactory.createLocalName(NameSpace, CharSequence)
NameFactory.createNameSpace(GenericName, Map)
NameFactory.parseGenericName(NameSpace, CharSequence)
isMixedNameSyntaxSupported
istrue
.
-
-