|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.derbyTesting.junit.BaseTestCase
public abstract class BaseTestCase
Base class for JUnit tests.
| Field Summary | |
|---|---|
protected static java.lang.String |
DEFAULT_DB_DIR
|
protected static java.lang.String |
DERBY_LOG
|
protected static java.lang.String |
ERRORSTACKTRACEFILE
|
private static java.io.PrintStream |
out
|
| Constructor Summary | |
|---|---|
private |
BaseTestCase()
No argument constructor made private to enforce naming of test cases. |
|
BaseTestCase(java.lang.String name)
Create a test case with the given name. |
| Method Summary | |
|---|---|
static void |
alarm(java.lang.String text)
Print alarm string |
static void |
assertEquals(java.io.File file1,
java.io.File file2)
Assert that two files in the filesystem are identical. |
static void |
assertEquals(java.io.InputStream is1,
java.io.InputStream is2)
Compare the contents of two streams. |
static void |
assertEquals(java.io.Reader r1,
java.io.Reader r2)
Compare the contents of two readers. |
void |
assertExecJavaCmdAsExpected(java.lang.String[] expectedString,
java.lang.String[] cmd,
int expectedExitValue)
Execute command using 'java' executable and verify that it completes with expected results |
static void |
assertSecurityManager()
Assert a security manager is installed. |
static void |
assertThrowableEquals(java.lang.Throwable t1,
java.lang.Throwable t2)
Assert that the detailed messages of the 2 passed-in Throwable's are equal (rather than '=='), as well as their class types. |
java.lang.Process |
execJavaCmd(java.lang.String[] cmd)
Execute a java command and return the process. |
static void |
fail(java.lang.String msg,
java.lang.Exception e)
Fail; attaching an exception for more detail on cause. |
java.io.File |
getFailureFolder()
Get the folder where a test leaves any information about its failure. |
static java.lang.String |
getJavaExecutableName()
Return the executable name for spawning java commands. |
protected static java.lang.String |
getSystemProperty(java.lang.String name)
Get system property. |
TestConfiguration |
getTestConfiguration()
Return the current configuration for the test. |
protected static java.net.URL |
getTestResource(java.lang.String name)
Obtain the URL for a test resource, e.g. a policy file or a SQL script. |
protected static java.io.InputStream |
openTestResource(java.net.URL url)
Open the URL for a a test resource, e.g. a policy file or a SQL script. |
static void |
println(java.lang.String text)
Print debug string. |
static void |
printStackTrace(java.lang.Throwable t)
Print debug string. |
java.lang.String |
readProcessOutput(java.lang.Process pr)
Reads output from a process and returns it as a string. |
static void |
removeDirectory(java.io.File dir)
Remove the directory and its contents. |
static void |
removeDirectory(java.lang.String path)
Remove the directory and its contents. |
protected static void |
removeSystemProperty(java.lang.String name)
Remove system property |
void |
runBare()
Run the test and force installation of a security manager with the default test policy file. |
protected static void |
setSystemProperty(java.lang.String name,
java.lang.String value)
Set system property |
static void |
traceit(java.lang.String text)
Print trace string. |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String ERRORSTACKTRACEFILE
protected static final java.lang.String DEFAULT_DB_DIR
protected static final java.lang.String DERBY_LOG
private static final java.io.PrintStream out
| Constructor Detail |
|---|
private BaseTestCase()
BaseTestCase(String)public BaseTestCase(java.lang.String name)
name - name of the test case.| Method Detail |
|---|
public void runBare()
throws java.lang.Throwable
runBare in class junit.framework.TestCasejava.lang.Throwablepublic final TestConfiguration getTestConfiguration()
public final java.io.File getFailureFolder()
TestConfiguration.getFailureFolder(TestCase)public static void alarm(java.lang.String text)
text - String to printpublic static void println(java.lang.String text)
text - String to printpublic static void traceit(java.lang.String text)
text - String to printpublic static void printStackTrace(java.lang.Throwable t)
t - Throwable object to print stack trace from
protected static void setSystemProperty(java.lang.String name,
java.lang.String value)
name - name of the propertyvalue - value of the propertyprotected static void removeSystemProperty(java.lang.String name)
name - name of the propertyprotected static java.lang.String getSystemProperty(java.lang.String name)
name - name of the propertyprotected static java.net.URL getTestResource(java.lang.String name)
name - Resource name, typically - org.apache.derbyTesing.something
protected static java.io.InputStream openTestResource(java.net.URL url)
throws java.security.PrivilegedActionException
url - URL obtained from getTestResource
java.security.PrivilegedActionExceptionpublic static void assertSecurityManager()
public static void assertEquals(java.io.InputStream is1,
java.io.InputStream is2)
throws java.io.IOException
is1 - the first streamis2 - the second stream
java.io.IOException - if reading from the streams fail
junit.framework.AssertionFailedError - if the stream contents are not equal
public static void assertEquals(java.io.Reader r1,
java.io.Reader r2)
throws java.io.IOException
r1 - the first readerr2 - the second reader
java.io.IOException - if reading from the streams fail
junit.framework.AssertionFailedError - if the reader contents are not equal
public static void assertThrowableEquals(java.lang.Throwable t1,
java.lang.Throwable t2)
t1 - first throwable to comparet2 - second throwable to compare
public static void assertEquals(java.io.File file1,
java.io.File file2)
file1 - the first file to comparefile2 - the second file to compare
public void assertExecJavaCmdAsExpected(java.lang.String[] expectedString,
java.lang.String[] cmd,
int expectedExitValue)
throws java.lang.InterruptedException,
java.io.IOException
expectedString - String to compare the resulting output with. May be
null if the output is not expected to be of interest.cmd - array of java arguments for commandexpectedExitValue - expected return value from the command
java.lang.InterruptedException
java.io.IOException
public java.lang.Process execJavaCmd(java.lang.String[] cmd)
throws java.io.IOException
cmd - array of java arguments for command
java.io.IOExceptionpublic static final java.lang.String getJavaExecutableName()
public java.lang.String readProcessOutput(java.lang.Process pr)
throws java.lang.InterruptedException
pr - a running process
java.lang.InterruptedExceptionpublic static void removeDirectory(java.lang.String path)
path - Path of the directorypublic static void removeDirectory(java.io.File dir)
dir - File of the directory
public static void fail(java.lang.String msg,
java.lang.Exception e)
throws junit.framework.AssertionFailedError
msg - message explaining the failuree - exception related to the cause
junit.framework.AssertionFailedError
|
Built on Wed 2009-11-25 18:43:31-0800, from revision 884373 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||