public static interface Testing.Files
| Modifier and Type | Method and Description |
|---|---|
static File |
createTestingDirectory(String relativePath)
Create a directory within the test data directory at the given relative path.
|
static File |
createTestingDirectory(String relativePath,
boolean removeExistingContent)
Create a directory within the test data directory at the given relative path.
|
static File |
createTestingFile()
Create a randomly-named file within the test data directory.
|
static File |
createTestingFile(Path relativePath)
Create a file within the test data directory at the given relative path.
|
static File |
createTestingFile(String relativePath)
Create a file within the test data directory at the given relative path.
|
static Path |
createTestingPath(String relativePath)
Create the path to a file within the test data directory at the given relative path.
|
static void |
delete(File fileOrFolder)
A method that will delete a file or folder only if it is within the 'target' directory (for safety).
|
static void |
delete(Path path)
A method that will delete a file or folder only if it is within the 'target' directory (for safety).
|
static void |
delete(String path)
A method that will delete a file or folder only if it is within the 'target' directory (for safety).
|
static boolean |
inTargetDir(File file)
Verify that the supplied file or directory is within the target directory.
|
static boolean |
inTargetDir(Path path)
Verify that the supplied file or directory is within the target directory.
|
static InputStream |
readResourceAsStream(String pathOnClasspath)
Obtain an InputStream to a named resource on the classpath used to load this
Testing class. |
static InputStream |
readResourceAsStream(String pathOnClasspath,
Class<?> testClass)
Obtain an InputStream to a named resource on the given classpath.
|
static String |
readResourceAsString(String pathOnClasspath)
Read a classpath resource into a string.
|
static InputStream readResourceAsStream(String pathOnClasspath, Class<?> testClass)
pathOnClasspath - the path of the resource on the classpathtestClass - the test class, used for accessing the class loaderstatic InputStream readResourceAsStream(String pathOnClasspath)
Testing class.pathOnClasspath - the path of the resource on the classpathstatic String readResourceAsString(String pathOnClasspath)
pathOnClasspath - the path of the resource on the classpathstatic File createTestingDirectory(String relativePath)
relativePath - the path of the directory within the test data directory; may not be nullstatic File createTestingFile()
static File createTestingFile(String relativePath)
relativePath - the path of the file within the test data directory; may not be nullstatic File createTestingFile(Path relativePath)
relativePath - the path of the file within the test data directory; may not be nullstatic Path createTestingPath(String relativePath)
relativePath - the path of the file within the test data directory; may not be nullstatic File createTestingDirectory(String relativePath, boolean removeExistingContent) throws IOException
relativePath - the path of the directory within the test data directory; may not be nullremoveExistingContent - true if any existing content should be removedIOException - if there is a problem deleting the files at this pathstatic void delete(String path)
path - the path to the file or folder in the target directorystatic void delete(File fileOrFolder)
fileOrFolder - the file or folder in the target directorystatic void delete(Path path)
path - the path to the file or folder in the target directorystatic boolean inTargetDir(File file)
file - the file or directory; may not be nullstatic boolean inTargetDir(Path path)
path - the path to the file or directory; may not be nullCopyright © 2016 JBoss by Red Hat. All rights reserved.