|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nl.justobjects.toolkit.sys.Test
Test Harness
Test Harness for production of standard test reports
Test t1 = new Test("All_Pass"); Test t2 = new Test("All_Fail"); t1.check(true,"Boolean check that passes"); t2.check(false,"Boolean check that fails"); t1.checkEquals("Foo","Foo","Object comparison that passes"); t2.checkEquals("Foo","Bar","Object comparison that fails"); t1.checkEquals(1,1,"Long comparison that passes"); t2.checkEquals(1,2,"Long comparison that fails"); t1.checkEquals(1.1,1.1,"Double comparison that passes"); t2.checkEquals(1.1,2.2,"Double comparison that fails"); t1.checkEquals('a','a',"Char comparison that passes"); t2.checkEquals('a','b',"Char comparison that fails"); Test.report();
Field Summary | |
private static java.lang.String |
fail
|
private static java.lang.String |
pass
|
private boolean |
passed
|
private java.lang.StringBuffer |
reportBuf
|
private static java.lang.String |
SelfFailTest
|
private static char[] |
spaces
|
private java.lang.String |
testCase
|
private static java.util.Vector |
tests
|
Constructor Summary | |
Test(java.lang.String testCase)
Test contructor |
Method Summary | |
void |
check(boolean b,
java.lang.String check)
Check a boolean test case |
void |
checkContains(java.lang.String string,
java.lang.String subString,
java.lang.String check)
Check that string contains a substring |
void |
checkEquals(char c1,
char c2,
java.lang.String check)
Check a a pair of chars for equality |
void |
checkEquals(double d1,
double d2,
java.lang.String check)
Check a a pair of doubles for equality |
void |
checkEquals(java.io.InputStream in1,
java.io.InputStream in2,
java.lang.String check)
Check contents of a pair of InputStreams for equality |
void |
checkEquals(long l1,
long l2,
java.lang.String check)
Check a a pair of longs for equality |
void |
checkEquals(java.lang.Object o1,
java.lang.Object o2,
java.lang.String check)
Check a pair of objects for equality test case |
private void |
commonCheckEquals(java.lang.Object o1,
java.lang.Object o2,
java.lang.String check)
Internal check a pair of objects for equality test case |
static void |
main(java.lang.String[] args)
|
static void |
report()
Produce test report |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static java.util.Vector tests
private static final java.lang.String pass
private static final java.lang.String fail
private static final char[] spaces
private static final java.lang.String SelfFailTest
private java.lang.String testCase
private java.lang.StringBuffer reportBuf
private boolean passed
Constructor Detail |
public Test(java.lang.String testCase)
testCase
- the name of the test caseMethod Detail |
public void check(boolean b, java.lang.String check)
b
- Boolean to checkcheck
- Description of this checkpublic void checkContains(java.lang.String string, java.lang.String subString, java.lang.String check)
b
- Boolean to checkcheck
- Description of this checkpublic void checkEquals(java.lang.Object o1, java.lang.Object o2, java.lang.String check)
o1
- First object to compareo2
- Second object to comparecheck
- Description of this checkpublic void checkEquals(long l1, long l2, java.lang.String check)
l1
- First Long to comparel2
- Second Long to comparecheck
- Description of this checkpublic void checkEquals(double d1, double d2, java.lang.String check)
d1
- First double to compared2
- Second double to comparecheck
- Description of this checkpublic void checkEquals(char c1, char c2, java.lang.String check)
c1
- First char to comparec2
- Second char to comparecheck
- Description of this checkpublic void checkEquals(java.io.InputStream in1, java.io.InputStream in2, java.lang.String check)
in1
- First InputStreamin2
- Second InputStreamcheck
- Descriptionprivate void commonCheckEquals(java.lang.Object o1, java.lang.Object o2, java.lang.String check)
o1
- First object to compareo2
- Second object to comparecheck
- Description of this checkpublic static void report()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |