public final class TestResources
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.io.File |
getDirectory(java.lang.Class<?> clazz,
java.lang.String path)
Returns a file that is a directory from resources.
|
static java.io.File |
getDirectory(java.lang.String name)
Variant of
getDirectory(Class, String) that only works with absolute paths, so
doesn't need a "context" class. |
static java.io.File |
getFile(java.lang.Class<?> clazz,
java.lang.String name)
Returns a file from class resources.
|
static java.io.File |
getFile(java.lang.String name)
Variant of
getFile(Class, String) that only works with absolute paths, so doesn't
need a "context" class. |
static void |
getFileInDirectory(java.lang.Class<?> clazz,
java.lang.String resourceName,
java.lang.String filePath)
Given a
resourceName relative to clazz , copies the resource to a new file
at filePath and registers that to be deleted when the JVM exits. |
public static java.io.File getFile(java.lang.String name)
getFile(Class, String)
that only works with absolute paths, so doesn't
need a "context" class.getFile(Class, String)
public static java.io.File getFile(java.lang.Class<?> clazz, java.lang.String name)
clazz
- Test class.name
- Resource name.public static void getFileInDirectory(java.lang.Class<?> clazz, java.lang.String resourceName, java.lang.String filePath)
resourceName
relative to clazz
, copies the resource to a new file
at filePath
and registers that to be deleted when the JVM exits. If there is an
existing file at filePath
, it does nothing.clazz
- Resource class.resourceName
- Input name to get resource from class.filePath
- Output file name in specific directory.public static java.io.File getDirectory(java.lang.String name)
getDirectory(Class, String)
that only works with absolute paths, so
doesn't need a "context" class.getDirectory(Class, String)
public static java.io.File getDirectory(java.lang.Class<?> clazz, java.lang.String path)
clazz
- Class with resources.path
- Directory path.