01: //Copyright (c) Corporation for National Research Initiatives
02: package javatests;
03:
04: /**
05: * @author updikca1
06: */
07: public class TestSupport {
08:
09: public static class AssertionError extends RuntimeException {
10:
11: public AssertionError() {
12: super ();
13: }
14:
15: public AssertionError(String message) {
16: super (message);
17: }
18:
19: /* not until java 1.4
20: public AssertionError(String message, Throwable cause) {
21: super(message, cause);
22: }
23:
24: public AssertionError(Throwable cause) {
25: super(cause);
26: }
27: */
28: }
29:
30: public static void assertThat(boolean test, String message) {
31:
32: if (test == false) {
33: throw new AssertionError(message);
34: }
35: }
36:
37: public static void assertEquals(Object a, Object b, String message) {
38:
39: assertThat(a.equals(b), message + "[a.equals(b) failed]");
40: assertThat(b.equals(a), message + "[b.equals(a) failed]");
41: }
42:
43: public static void assertNotEquals(Object a, Object b,
44: String message) {
45:
46: assertThat(!a.equals(b), message + "[not a.equals(b) failed]");
47: assertThat(!b.equals(a), message + "[not b.equals(a) failed]");
48: }
49: }
|