Class FixtureUtilities
OnlineTestCase and OnlineTestSupport for details.- Author:
- Ben Caradoc-Davies, CSIRO Earth Science and Resource Engineering
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FileReturn the directory containing GeoTools test fixture configuration files.static FilegetFixtureFile(File fixtureDirectory, String fixtureId) Return the file that should contain the fixture configuration properties.static PropertiesloadFixture(String fixtureId) Return Properties loaded from a fixture configuration file, or null if not found.static PropertiesloadProperties(File file) LoadPropertiesfrom aFile.static voidprintSkipNotice(String fixtureId, File fixtureFile) Print a notice that tests are being skipped, identifying the property file whose absence is responsible.
-
Constructor Details
-
FixtureUtilities
public FixtureUtilities()
-
-
Method Details
-
loadProperties
LoadPropertiesfrom aFile. -
getFixtureDirectory
Return the directory containing GeoTools test fixture configuration files. This is ".geotools" in the user home directory. -
getFixtureFile
Return the file that should contain the fixture configuration properties. It is not guaranteed to exist.Dots "." in the fixture id represent a subdirectory path under the GeoTools configuration file directory. For example, an id
a.b.foowould be resolved to.geotools/a/b/foo.properties. the base fixture configuration file directory, typically ".geotools" in the user home directory. the fixture id -
printSkipNotice
Print a notice that tests are being skipped, identifying the property file whose absence is responsible.- Parameters:
fixtureId- the fixture idfixtureFile- the missing fixture configuration file
-
loadFixture
Return Properties loaded from a fixture configuration file, or null if not found.If a fixture configuration file is not found, a notice is printed to standard output stating that tests for this fixture id are skipped.
This method allows tests that cannot extend
OnlineTestCaseorOnlineTestSupportbecause they already extend another class (for example, a non-online test framework) to access fixture configuration files in the same way that those classes do. Only basic fixture configuration loading is supported. This method does not support the extra services such as fixture caching and connection testing provided byOnlineTestCaseandOnlineTestSupport.A JUnit 4 test fixture can readily be disabled in the absence of a fixture configuration file by placing
Assume.assumeNotNull(FixtureUtilities.loadFixture(fixtureId))or similar in its@BeforeClassmethod. JUnit 3 tests must provide their own logic, typically overridingTestCase.run()orTestCase.runTest(), or providing a suite.- Parameters:
fixtureId- the fixture id, where dots "." are converted to subdirectories.- Returns:
- the fixture Properties or null
- See Also:
-