public class FixtureUtilities extends Object
OnlineTestCase
and OnlineTestSupport
for details.Constructor and Description |
---|
FixtureUtilities() |
Modifier and Type | Method and Description |
---|---|
static File |
getFixtureDirectory()
Return the directory containing GeoTools test fixture configuration files.
|
static File |
getFixtureFile(File fixtureDirectory,
String fixtureId)
Return the file that should contain the fixture configuration properties.
|
static Properties |
loadFixture(String fixtureId)
Return Properties loaded from a fixture configuration file, or null if not found.
|
static Properties |
loadProperties(File file)
Load
Properties from a File . |
static void |
printSkipNotice(String fixtureId,
File fixtureFile)
Print a notice that tests are being skipped, identifying the property file whose absence is
responsible.
|
public static Properties loadProperties(File file)
Properties
from a File
.public static File getFixtureDirectory()
public static File getFixtureFile(File fixtureDirectory, String fixtureId)
Dots "." in the fixture id represent a subdirectory path under the GeoTools configuration
file directory. For example, an id a.b.foo
would be resolved to
.geotools/a/b/foo.properties
.
the base fixture configuration file directory, typically ".geotools" in the user
home directory.
the fixture id
public static void printSkipNotice(String fixtureId, File fixtureFile)
fixtureId
- the fixture idfixtureFile
- the missing fixture configuration filepublic static Properties loadFixture(String fixtureId)
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 OnlineTestCase
or OnlineTestSupport
because 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 by OnlineTestCase
and OnlineTestSupport
.
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 @BeforeClass
method. JUnit 3 tests must provide their own logic,
typically overriding TestCase.run()
or TestCase.runTest()
, or providing a
suite.
fixtureId
- the fixture id, where dots "." are converted to subdirectories.OnlineTestCase
,
OnlineTestSupport
Copyright © 1996–2023 Geotools. All rights reserved.