public final class TestUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Path |
getInputsDir(Class<?> testsuiteClass)
Retrieves the directory containing the test input files for the
given testsuite class.
|
static Path |
getPath(Class<?> testSuiteClass,
String pathName)
Retrives the path for a test file related with the given
testsuit class.
|
static String |
getSystemProperty(String key)
Retrieves the value of a given system property.
|
static Path |
newTempDir(Class<?> testSuiteClass)
Retrieves the directory to be used as temporary directory for
the given testsuite class.
|
public static String getSystemProperty(String key)
key
- The name of the system property whose value is to be
returned.public static Path getInputsDir(Class<?> testsuiteClass)
By convention the path of directory with test input files is obtained in the following way:
TestUtils.inputTestFilesDir
system property. This
is usually set to ${basedir}/test/resources
in the
Maven project pom.xml
.testsuiteClass
- Class for which we will return in directory
with input files for the corresponding testsuite.public static Path newTempDir(Class<?> testSuiteClass) throws IOException
The temporary directory will be created under the path
specified by the TestUtils.tmpTestFilesDir
system
property. The base name of the temporary directory is generated
automatically.
The returned path will be different every time this method is called. This method is intended to be called from within test cases. Each test case should call this method to have its down dedicated temporary directory.
When this method returns, the temporary directory is sure to exist.
testSuiteClass
- The Java class of the testsuite for
which we are to return its dedicated temporary directory.IOException
- If there were any problems creating the
temporary directory.public static Path getPath(Class<?> testSuiteClass, String pathName)
The pathName
is assumed to be relative to the
inputs directory for the given testsuit class. See
for a description on on how the
inputs directory is obtained.getInputsDir(Class)
testSuiteClass
- pathName
- A path relative to the inputs directory for the
given testsuite class.Yawg 1.0.0-RC3-202102211255
Copyright © 2015–2020 Yawg project contributors. All rights reserved.