|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.util.test.io.FileTestUtils
public final class FileTestUtils
Utilities to make unit tests with files easier.
Method Summary | |
---|---|
static File |
getFileFromRelativeResource(Class<?> type, String relativeResourceName) Returns the specified file from a resource relative to the given type. |
static File |
getFileFromResource(Class<?> type, String resourceName) Returns the specified file from the class loader associated with the given type. |
static File |
getFileFromResource(ClassLoader classLoader, String resourceName) Returns the specified file from the specified class loader. |
static File |
getFileFromResource(String resourceName) Returns the specified file from the class path. |
static Properties |
getPropertiesFromRelativePropertiesFileForClass(Class<?> clazz) Returns a properties object backed by the specified file from a resource relative to the given type with the simple name of the resource with an ending .properties . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static File getFileFromResource(String resourceName)
resourceName
- name of the resource (file or directory) in the class path.
null
if the resource does not exist, is not accessible via the
file:/
protocol or due to missing privileges.
public static File getFileFromResource(ClassLoader classLoader, String resourceName)
classLoader
- the class loader to load the resource from.
resourceName
- name of the resource (file or directory) in the class path.
null
if the resource does not exist, is not accessible via the
file:/
protocol or due to missing privileges.
public static File getFileFromResource(Class<?> type, String resourceName)
type
- the type to refer to the class loader to load the resource from. The resource is relative to this type.
resourceName
- name of the resource (file or directory) in the class path.
null
if the resource does not exist, is not accessible via the
file:/
protocol or due to missing privileges.
public static File getFileFromRelativeResource(Class<?> type, String relativeResourceName)
type
- the type to refer to the class loader to load the resource from. The resource is relative to this type.
relativeResourceName
- name of the resource (file or directory) in the class path, relative to the passed in
type
.
null
if the resource does not exist, is not accessible via the
file:/
protocol or due to missing privileges.
public static Properties getPropertiesFromRelativePropertiesFileForClass(Class<?> clazz)
.properties
.
clazz
- the type to refer to the class loader to load the resource from. The resource is relative to this type and has its simple name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |