01: /*
02: * ====================================================================
03: * Copyright (c) 2004 Marc Strapetz, marc.strapetz@smartsvn.com.
04: * All rights reserved.
05: *
06: * This software is licensed as described in the file COPYING, which
07: * you should have received as part of this distribution. Use is
08: * subject to license terms.
09: * ====================================================================
10: */
11:
12: package de.regnis.q.sequence.core;
13:
14: /**
15: * @author Marc Strapetz
16: */
17: public final class QSequenceAssert {
18:
19: // Static =================================================================
20:
21: public static void assertNotNull(Object obj) {
22: assertTrue(obj != null, "Object must not be null!");
23: }
24:
25: public static void assertNotNull(Object obj, String text) {
26: assertTrue(obj != null, "Object must not be null: " + text);
27: }
28:
29: public static void assertEquals(int i1, int i2) {
30: assertTrue(i1 == i2, i1 + " != " + i2);
31: }
32:
33: public static void assertEquals(long l1, long l2) {
34: assertTrue(l1 == l2, l1 + " != " + l2);
35: }
36:
37: public static void assertTrue(boolean forceTrueCondition) {
38: assertTrue(forceTrueCondition, "");
39: }
40:
41: public static void assertTrue(boolean forceTrueCondition,
42: String text) {
43: if (!forceTrueCondition) {
44: error(text);
45: }
46: }
47:
48: public static void error(String text) {
49: throw new InternalError(text);
50: }
51:
52: public static void fatal(String text) {
53: throw new InternalError(text);
54: }
55:
56: // Setup ==================================================================
57:
58: private QSequenceAssert() {
59: }
60: }
|