public class Assert
1: //: com:bruceeckel:tools:debug:Assert.java
2: // From 'Thinking in Java, 2nd ed.' by Bruce Eckel
3: // www.BruceEckel.com. See copyright notice in CopyRight.txt.
4: // Assertion tool for debugging.
5: package com.bruceeckel.tools.debug;
7: public class Assert {
8: private static void perr(String msg) {
9: System.err.println(msg);
10: }
11: public final static void is_true(boolean exp) {
12: if(!exp) perr("Assertion failed");
13: }
14: public final static void is_false(boolean exp){
15: if(exp) perr("Assertion failed");
16: }
17: public final static void
18: is_true(boolean exp, String msg) {
19: if(!exp) perr("Assertion failed: " + msg);
20: }
21: public final static void
22: is_false(boolean exp, String msg) {
23: if(exp) perr("Assertion failed: " + msg);
24: }
25: } ///:~