|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.javaranch.common.ErrorLog | +--com.javaranch.common.TestLog
Used when unit testing code.
This class is to be used only in conjunction with the UnitTest framework.
See UnitTest.java for details.
- - - - - - - - - - - - - - - - -
Copyright (c) 1999-2004 Paul Wheaton
You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...
My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.
The original source can be found at JavaRanch
- - - - - - - - - - - - - - - - -
Constructor Summary | |
TestLog()
|
Method Summary | |
void |
fail()
The message "test fail" plus the source file name and line number are added to the log. |
void |
fail(java.lang.String message)
The message "test fail:" plus the message, source file name and line number are added to the log. |
void |
test(boolean b)
If false is passed in, the message "test fail" plus the source file name and line number are added to the log. |
void |
test(boolean b,
java.lang.String message)
If false is passed in, the text "test fail: " plus the message, source file name and line number are added to the log. |
void |
test(char testResult,
char expected)
If the two values do not match, the discrepency, the file name and the line number will be added to the log. |
void |
test(char testResult,
char expected,
java.lang.String message)
If the two values do not match, the discrepency, the message, the file name and the line number will be added to the log. |
void |
test(int testResult,
int expected)
If the two values do not match, the discrepency, the file name and the line number will be added to the log. |
void |
test(int testResult,
int expected,
java.lang.String message)
If the two values do not match, the discrepency, the message, the file name and the line number will be added to the log. |
void |
test(long testResult,
long expected)
If the two values do not match, the discrepency, the file name and the line number will be added to the log. |
void |
test(long testResult,
long expected,
java.lang.String message)
If the two values do not match, the discrepency, the message, the file name and the line number will be added to the log. |
void |
test(java.lang.Object testResult,
java.lang.Object expected)
If the two values do not match, the discrepency, the file name and the line number will be added to the log. |
void |
test(java.lang.Object testResult,
java.lang.Object expected,
java.lang.String message)
If the two values do not match, the discrepency, the message, the file name and the line number will be added to the log. |
void |
testRange(double testResult,
double low,
double high)
If the two values do not match, the discrepency, the file name and the line number will be added to the log. |
void |
testRange(double testResult,
double low,
double high,
java.lang.String message)
If the two values do not match, the discrepency, the message, the file name and the line number will be added to the log. |
Methods inherited from class com.javaranch.common.ErrorLog |
add, addAndDisplay, appendLogFile, getList, isConsoleLogOn, isFileLogOn, isInternalLogOn, numErrors, setConsole, setInternalLog, setLogFile, setLogFileOff |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TestLog()
Method Detail |
public void fail()
public void fail(java.lang.String message)
public void test(boolean b)
public void test(boolean b, java.lang.String message)
public void test(int testResult, int expected)
The message will look similar to this: test result "5" does not match expected value "2".
This method will be used for testing byte and short values too.
public void test(int testResult, int expected, java.lang.String message)
The message will look similar to this: test result "5" does not match expected value "2". Too many pancakes.
This method will be used for testing byte and short values too.
public void test(char testResult, char expected)
The message will look similar to this: test result "5" does not match expected value "2".
public void test(char testResult, char expected, java.lang.String message)
The message will look similar to this: test result "5" does not match expected value "2". Too many pancakes.
public void test(long testResult, long expected)
The message will look similar to this: test result "5" does not match expected value "2".
public void test(long testResult, long expected, java.lang.String message)
The message will look similar to this: test result "5" does not match expected value "2". Too many pancakes.
public void testRange(double testResult, double low, double high)
The message will look similar to this: test result "5" does not match expected value "2".
This method will be used for testing float values too.
Because of the imprecision of floating point, floats and doubles must be tested with a range.
public void testRange(double testResult, double low, double high, java.lang.String message)
The message will look similar to this: test result "5" does not match expected value "2". Too many pancakes.
This method will be used for testing float values too.
Because of the imprecision of floating point, floats and doubles must be tested with a range.
public void test(java.lang.Object testResult, java.lang.Object expected)
The message will look similar to this: test result "5" does not match expected value "2".
Note that the objects must properly implement the equals() method and the toString() method.
public void test(java.lang.Object testResult, java.lang.Object expected, java.lang.String message)
The message will look similar to this: test result "5" does not match expected value "2". Too many pancakes.
Note that the objects must properly implement the equals() method and the toString() method.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |