org.mortbay.util
Class TestCase
java.lang.Object
org.mortbay.util.TestCase
public class TestCase
extends java.lang.Object
Test Harness and report.
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();
$Id: TestCase.java,v 1.8 2005/08/13 00:01:28 gregwilkins Exp $TestCase(String testCase) - TestCase constructor.
|
void | check(boolean b, String check) - Check a boolean test case.
|
int | checkContains(String string, String subString, String check) - Check that string contains a substring.
|
int | checkContains(String string, int offset, String subString, String check) - Check that string contains a substring.
|
void | checkEquals(InputStream in1, InputStream in2, String check) - Check contents of a pair of InputStreams for equality.
|
void | checkEquals(Object o1, Object o2, String check) - Check a pair of objects for equality test case.
|
void | checkEquals(char c1, char c2, String check) - Check a a pair of chars for equality.
|
void | checkEquals(double d1, double d2, String check) - Check a a pair of doubles for equality.
|
void | checkEquals(long l1, long l2, String check) - Check a a pair of longs for equality.
|
int | checkNotContained(String string, String subString, String check) - Check that string does not contain a substring.
|
int | checkNotContained(String string, int offset, String subString, String check) - Check that string does not contain a substring.
|
int | realCheckContains(String string, int offset, String subString, String check) - Check that string contains a substring.
|
static void | report() - Produce test report.
|
TestCase
public TestCase(String testCase)
TestCase constructor.
testCase
- the name of the test case
check
public void check(boolean b,
String check)
Check a boolean test case.
b
- Boolean to checkcheck
- Description of this check
checkContains
public int checkContains(String string,
String subString,
String check)
Check that string contains a substring.
checkContains
public int checkContains(String string,
int offset,
String subString,
String check)
Check that string contains a substring.
checkEquals
public void checkEquals(InputStream in1,
InputStream in2,
String check)
Check contents of a pair of InputStreams for equality.
in1
- First InputStreamin2
- Second InputStreamcheck
- Description
checkEquals
public void checkEquals(Object o1,
Object o2,
String check)
Check a pair of objects for equality test case.
o1
- First object to compareo2
- Second object to comparecheck
- Description of this check
checkEquals
public void checkEquals(char c1,
char c2,
String check)
Check a a pair of chars for equality.
c1
- First char to comparec2
- Second char to comparecheck
- Description of this check
checkEquals
public void checkEquals(double d1,
double d2,
String check)
Check a a pair of doubles for equality.
d1
- First double to compared2
- Second double to comparecheck
- Description of this check
checkEquals
public void checkEquals(long l1,
long l2,
String check)
Check a a pair of longs for equality.
l1
- First Long to comparel2
- Second Long to comparecheck
- Description of this check
checkNotContained
public int checkNotContained(String string,
String subString,
String check)
Check that string does not contain a substring.
checkNotContained
public int checkNotContained(String string,
int offset,
String subString,
String check)
Check that string does not contain a substring.
realCheckContains
public int realCheckContains(String string,
int offset,
String subString,
String check)
Check that string contains a substring.
report
public static void report()
Produce test report.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.