|
1 package org.mozilla.gecko; |
|
2 |
|
3 public class Assert |
|
4 { |
|
5 private Assert() {} |
|
6 |
|
7 public static void equals(Object a, Object b) |
|
8 { |
|
9 equals(a, b, null); |
|
10 } |
|
11 |
|
12 public static void equals(Object a, Object b, String message) |
|
13 { |
|
14 Assert.isTrue(a.equals(b), message); |
|
15 } |
|
16 |
|
17 public static void isTrue(boolean a) |
|
18 { |
|
19 isTrue(a, null); |
|
20 } |
|
21 |
|
22 public static void isTrue(boolean a, String message) |
|
23 { |
|
24 if (!AppConstants.DEBUG_BUILD) { |
|
25 return; |
|
26 } |
|
27 |
|
28 if (!a) { |
|
29 throw new AssertException(message); |
|
30 } |
|
31 } |
|
32 |
|
33 public static class AssertException extends RuntimeException |
|
34 { |
|
35 private static final long serialVersionUID = 0L; |
|
36 |
|
37 public AssertException(String message) { |
|
38 super(message); |
|
39 } |
|
40 } |
|
41 } |