Class AuthorityFactoryTestCase<T>

    • Field Detail

      • code

        public int code
        The EPSG code of the T instance to test. This field is set by all test methods before to create and to verify the T instance.

        This code can be compared to the identifiers returned by IdentifiedObject.getIdentifiers().

      • name

        public String name
        The name of the T instance to test, as used in the EPSG dataset. This field is set by all test methods before to create and to verify the T instance.

        This name will be compared to the value returned by IdentifiedObject.getName(), unless isStandardNameSupported is false.

      • aliases

        public String[] aliases
        The expected aliases of the T instance to test, or an empty array if none. This field is set by all test methods before to create and to verify the T instance.

        Those aliases will be compared to the values returned by IdentifiedObject.getAlias(), unless isStandardAliasSupported is false.

      • isStandardNameSupported

        protected boolean isStandardNameSupported
        true if the tested factories support name. If true (the default), then the test methods will ensure that the identified objects created by the factories declare the same name than the GIGS tests. If false, then the names are ignored.
      • isStandardAliasSupported

        protected boolean isStandardAliasSupported
        true if the tested factories support aliases. If true (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. If false, then the aliases are ignored.
    • Method Detail

      • 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 a createXXX(String) method from the user-specified AuthorityFactory with the current code value 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 returns object.getName().getCode() or null if the given object, its name or its code is null.

        Subclasses can override this method when testing an AuthorityFactory implementation 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:
         @Override
         protected String getVerifiableName(IdentifiedObject object) {
            return super.getVerifiableName().replace(' ', '_');
         }
        Note that if the object names are too different for being compared, then subclasses can also disable name comparisons by setting isStandardNameSupported to false.
        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