org.opengis.test.util
Class NameTest

Show UML class diagram
Object
  extended by TestCase
      extended by NameTest

public class NameTest
extends TestCase

Tests generic name and related objects from the org.opengis.util package. Name instances are created using a NameFactory given at construction time.

In order to specify their factory and run the tests in a JUnit framework, implementors can define a subclass as 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());
    }
}
Alternatively this test class can also be used directly in the TestSuite, which combine every tests defined in the GeoAPI conformance module.

Since:
2.2
See Also:
TestSuite

Field Summary
protected  NameFactory factory
          The factory to be used for testing generic name instances, or null if none.
protected  boolean isMixedNameSyntaxSupported
          true if the GenericName implementations created by the factory can use different syntax rules in different part of their name.
protected  boolean isMultiLocaleSupported
          true if the InternationalString implementations created by the factory can support more than one locale.
 
Fields inherited from class TestCase
configurationTip, listener, NO_FACTORY, validators
 
Constructor Summary
NameTest(NameFactory factory)
          Creates a new test using the given factory.
 
Method Summary
 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
addTestListener, factories, factories, getEnabledFlags, removeTestListener
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected final NameFactory factory
The factory to be used for testing generic name instances, or null if none.


isMultiLocaleSupported

protected boolean isMultiLocaleSupported
true if the InternationalString implementations created by the factory can support more than one locale. If false, then the factory method may retain only one locale among the set of user-provided localized strings.


isMixedNameSyntaxSupported

protected boolean isMixedNameSyntaxSupported
true if the GenericName 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 (e.g. ":", ".", "/" and "#" in "http://www.opengis.net/gml/srs/epsg.xml#4326") are supported. If false, then only a single rule can be applied to the name as a whole (e.g. only the ":" separator is used in "urn:ogc:def:crs:epsg:4326").

Constructor Detail

NameTest

public NameTest(NameFactory factory)
Creates a new test using the given factory. If the given factory is null, 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 the TestCase.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:

Overrides:
configuration in class TestCase
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[])

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:

This tests is executed only if isMixedNameSyntaxSupported is true.



Copyright © 1994-2013 Open Geospatial Consortium. All Rights Reserved.