ICU-3090 add JUnit-like assert methods

X-SVN-Rev: 14487
This commit is contained in:
Alan Liu 2004-02-12 01:08:32 +00:00
parent 00cd738b4a
commit 05643c4b10

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/TestFmwk.java,v $
* $Date: 2004/02/06 21:54:04 $
* $Revision: 1.60 $
* $Date: 2004/02/12 01:08:32 $
* $Revision: 1.61 $
*
*****************************************************************************************
*/
@ -1234,6 +1234,38 @@ public class TestFmwk extends AbstractTestLog {
return name;
}
/**
* JUnit-like assertions.
*/
protected void assertTrue(String message, boolean condition) {
if (!condition) {
errln("FAIL: assertTrue() failed: " + message);
} else if (VERBOSE_ASSERTIONS) {
logln("Ok: " + message);
}
}
protected void assertFalse(String message, boolean condition) {
if (condition) {
errln("FAIL: assertFalse() failed: " + message);
} else if (VERBOSE_ASSERTIONS) {
logln("Ok: " + message);
}
}
protected void assertEquals(String message,
Object expected, Object actual) {
if (!expected.equals(actual)) {
errln("FAIL: " + message + "; got " + actual +
"; expected " + expected);
} else if (VERBOSE_ASSERTIONS) {
logln("Ok: " + message + "; got " + actual);
}
}
protected void fail(String message) {
errln(message);
}
private static final boolean VERBOSE_ASSERTIONS = true;
protected TestParams params = null;
private final static String spaces = " ";