com.samskivert.test
Class TestUtil
java.lang.Object
com.samskivert.test.TestUtil
public class TestUtil
- extends Object
Utilities used by unit tests for the samskivert library which are
potentially useful for projects that wish to implement tests in the
same manner. The samskivert unit tests are built using the
JUnit testing framework.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TestUtil
public TestUtil()
getResourcePath
public static String getResourcePath(String path)
- Returns the path via which a test-related resource can be loaded.
This assumes that the mechanism used to invoke the test code
defined a system property named
test_dir which is the
path to the project top-level test directory, to which the supplied
path will be appended to obtain the path to the resource.
- Parameters:
path - the path to the resource, relative to the the top-level
test directory. It should contain a leading slash but one will be
provided if necessary.
getResourceAsStream
public static InputStream getResourceAsStream(String path)
throws FileNotFoundException
- Returns an input stream via which a test-related resource can be
loaded. The path is constructed as in
getResourcePath(java.lang.String).
- Parameters:
path - the path to the resource (see getResourcePath(java.lang.String)).
- Throws:
FileNotFoundException - thrown if the resource file with
the specified path does not exist.
Copyright © 2000-2008 Michael Bayne.
All Rights Reserved.