Package io.deephaven.base.verify
Class Assert
java.lang.Object
io.deephaven.base.verify.Assert
Assertion methods for simple runtime program verification. Failed assertions throw
AssertionFailure
.
Methods:
- void assertion(boolean condition, String conditionText[, String detailMessage])
- void assertion(boolean condition, String conditionText, value0, String name0, value1, String name0, ... )
- void statementNeverExecuted()
- void statementNeverExecuted(String statementDescription)
- void exceptionNeverCaught(Exception caughtException)
- void exceptionNeverCaught(String tryStatementDescription, Exception caughtException)
- void valueNeverOccurs(value, String name)
- void valuesNeverOccur(value0, name0, value1, name1, ... )
- void eq/neq(boolean/char/byte/short/int/long/float/double, String name0, boolean/char/byte/short/int/long/float/double[, String name1])
- void lt/leq/gt/geq(char/byte/short/int/long/float/double, String name0, char/byte/short/int/long/float/double[, String name1])
- void eqFalse/neqFalse/eqTrue/neqTrue(boolean, String name)
- void eqZero/neqZero(char/byte/short/int/long/float/double, String name)
- void ltZero/leqZero/gtZero/geqZero(byte/short/int/long/float/double, String name)
- void eq/neq(Object, name0, Object[, name1])
- void eqNull/neqNull(Object, String name)
- void equals(Object, String name0, Object, String name1)
- void nonempty(String, String name)
Naming Rationale:
- eq, neq, lt, leq, gt, get correspond to ==, !=, <, <=, >, >=, e.g.,
- For Object a and b, Assert.eq(a, "a", b, "b") corresponds to assert (a == b)
- For Object o, Assert.neqNull(o, "o") corresponds to assert (o != null)
- for int x, Assert.eqZero(x, "x") corresponds to assert (x == 0)
- equals corresponds to Object.equals (preceded by necessary null checks), e.g.,
- For Object a and b, Assert.equals(a, "a", b, "b") corresponds to assert (a!= null && b != null && a.equals(b))
- for String s, Assert.nonempty(s, "s") corresponds to assert (s != null && s.length() != 0)
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assert (condition, conditionText)static void
assert (condition, conditionText, boolean b0, String name0, ...static void
assertion
(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1) static void
assertion
(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2) static void
assertion
(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2, boolean b3, String name3) static void
assert (condition, conditionText, int i0, String name0, ...static void
static void
assert (condition, conditionText, Object o0, String name0, ...static void
assertion
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1) static void
assertion
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, int i2, String name2) static void
assertion
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2) static void
assertion
(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2, Object o3, String name3) static void
assert (condition, conditionText, detailMessage)static void
static void
assert (b0 == b1)static void
static void
assert (b0 == b1)static void
static void
assert (c0 == c1)static void
static void
assert (d0 == d1)static void
static void
assert (f0 == f1)static void
static void
assert (i0 == i1)static void
static void
assert (l0 == l1)static void
static void
assert (s0 == s1)static void
static void
assert (o0 == o1)static void
assert (b == false)static void
assert (Double.isNaN(d))static void
assert (o == null)static void
assert (b == true)static void
assert (o0 != null && o1 != null && o0.equals(o1))static void
assert (o0 != null && o1 != null && o0.equals(o1))static void
assert (b == 0)static void
assert (c == 0)static void
assert (d == 0)static void
assert (f == 0)static void
assert (i == 0)static void
assert (l == 0)static void
assert (s == 0)static AssertionFailure
assert (this exception is never caught, Exception e)static AssertionFailure
exceptionNeverCaught
(String tryStatementDescription, Exception e) assert (tryStatementDescription succeeds, Exception e)static void
static void
assert (b0 >= b1)static void
static void
assert (c0 >= c1)static void
static void
assert (d0 >= d1)static void
static void
assert (f0 >= f1)static void
static void
assert (i0 >= i1)static void
static void
assert (l0 >= l1)static void
static void
assert (s0 >= s1)static void
assert (b >= 0)static void
assert (d >= 0)static void
assert (f >= 0)static void
assert (i >= 0)static void
assert (l >= 0)static void
assert (s >= 0)static void
static void
assert (b0 > b1)static void
static void
assert (c0 > c1)static void
static void
assert (d0 > d1)static void
static void
assert (f0 > f1)static void
static void
assert (i0 > i1)static void
static void
assert (l0 > l1)static void
static void
assert (s0 > s1)static void
assert (b > 0)static void
assert (d > 0)static void
assert (f > 0)static void
assert (i > 0)static void
assert (l > 0)static void
assert (s > 0)static void
static void
assert (b0 <= b1)static void
static void
assert (c0 <= c1)static void
static void
assert (d0 <= d1)static void
static void
assert (f0 <= f1)static void
static void
assert (i0 <= i1)static void
static void
assert (l0 <= l1)static void
static void
assert (s0 <= s1)static void
assert (b <= 0)static void
assert (d <= 0)static void
assert (f <= 0)static void
assert (i <= 0)static void
assert (l <= 0)static void
assert (s <= 0)static void
static void
assert (b0 < b1)static void
static void
assert (c0 < c1)static void
static void
assert (d0 < d1)static void
static void
assert (f0 < f1)static void
static void
assert (i0 < i1)static void
static void
assert (l0 < l1)static void
static void
assert (s0 < s1)static void
assert (b < 0)static void
assert (d < 0)static void
assert (f < 0)static void
assert (i < 0)static void
assert (l < 0)static void
assert (s < 0)static void
static void
assert (b0 != b1)static void
static void
assert (b0 != b1)static void
static void
assert (c0 != c1)static void
static void
assert (d0 != d1)static void
static void
assert (f0 != f1)static void
static void
assert (i0 != i1)static void
static void
assert (l0 != l1)static void
static void
assert (s0 != s1)static void
static void
assert (o0 != o1)static void
assert (b != false)static void
assert (!Double.isNaN(d)static void
assert (o != null)static void
assert (b != true)static void
assert (b != 0)static void
assert (c != 0)static void
assert (d != 0)static void
assert (f != 0)static void
assert (i != 0)static void
assert (l != 0)static void
assert (s != 0)static <TYPE> TYPE
neverInvoked
(TYPE t1, TYPE t2) static void
assert (s != null && s.length() > 0)static void
assert (o0 != null && o1 != null && !o0.equals(o1))static void
assert (o0 != null && o1 != null && !o0.equals(o1))static void
nullSafeEquals
(Object o0, String name0, Object o1, String name1) assert ((o0 == null && o1 == null) || (o0 != null && o0.equals(o1)))static boolean
setOnAssertionCallback
(Consumer<AssertionFailure> newCallback) static AssertionFailure
assert (this statement is never executed)static AssertionFailure
statementNeverExecuted
(String statementDescription) assert (statementDescription is never executed)static AssertionFailure
valueNeverOccurs
(boolean b, String name) assert (this value never occurs, boolean b, name)static AssertionFailure
valueNeverOccurs
(byte b, String name) assert (this value never occurs, byte b, name)static AssertionFailure
valueNeverOccurs
(char c, String name) assert (this value never occurs, char c, name)static AssertionFailure
valueNeverOccurs
(double d, String name) assert (this value never occurs, double d, name)static AssertionFailure
valueNeverOccurs
(float f, String name) assert (this value never occurs, float f, name)static AssertionFailure
valueNeverOccurs
(int i, String name) assert (this value never occurs, int i, name)static AssertionFailure
valueNeverOccurs
(long l, String name) assert (this value never occurs, long l, name)static AssertionFailure
valueNeverOccurs
(short s, String name) assert (this value never occurs, short s, name)static AssertionFailure
valueNeverOccurs
(Object o, String name) assert (this value never occurs, Object o, name)
-
Method Details
-
setOnAssertionCallback
-
assertion
assert (condition, conditionText) -
assertion
assert (condition, conditionText, detailMessage) -
assertion
assert (condition, conditionText, Object o0, String name0, ... ) -
assertion
-
assertion
-
assertion
-
assertion
-
assertion
assert (condition, conditionText, boolean b0, String name0, ... ) -
assertion
-
assertion
-
assertion
-
assertion
assert (condition, conditionText, int i0, String name0, ... ) -
assertion
-
statementNeverExecuted
assert (this statement is never executed) -
statementNeverExecuted
assert (statementDescription is never executed) -
exceptionNeverCaught
assert (this exception is never caught, Exception e) -
exceptionNeverCaught
assert (tryStatementDescription succeeds, Exception e) -
valueNeverOccurs
assert (this value never occurs, Object o, name) -
valueNeverOccurs
assert (this value never occurs, boolean b, name) -
valueNeverOccurs
assert (this value never occurs, char c, name) -
valueNeverOccurs
assert (this value never occurs, byte b, name) -
valueNeverOccurs
assert (this value never occurs, short s, name) -
valueNeverOccurs
assert (this value never occurs, int i, name) -
valueNeverOccurs
assert (this value never occurs, long l, name) -
valueNeverOccurs
assert (this value never occurs, float f, name) -
valueNeverOccurs
assert (this value never occurs, double d, name) -
eq
assert (b0 == b1) -
eq
-
eq
assert (c0 == c1) -
eq
-
eq
assert (b0 == b1) -
eq
-
eq
assert (s0 == s1) -
eq
-
eq
assert (i0 == i1) -
eq
-
eq
assert (l0 == l1) -
eq
-
eq
assert (f0 == f1) -
eq
-
eq
assert (d0 == d1) -
eq
-
neq
assert (b0 != b1) -
neq
-
neq
assert (c0 != c1) -
neq
-
neq
assert (b0 != b1) -
neq
-
neq
assert (s0 != s1) -
neq
-
neq
assert (i0 != i1) -
neq
-
neq
assert (l0 != l1) -
neq
-
neq
assert (f0 != f1) -
neq
-
neq
assert (d0 != d1) -
neq
-
lt
assert (c0 < c1) -
lt
-
lt
assert (b0 < b1) -
lt
-
lt
assert (s0 < s1) -
lt
-
lt
assert (i0 < i1) -
lt
-
lt
assert (l0 < l1) -
lt
-
lt
assert (f0 < f1) -
lt
-
lt
assert (d0 < d1) -
lt
-
leq
assert (c0 <= c1) -
leq
-
leq
assert (b0 <= b1) -
leq
-
leq
assert (s0 <= s1) -
leq
-
leq
assert (i0 <= i1) -
leq
-
leq
assert (l0 <= l1) -
leq
-
leq
assert (f0 <= f1) -
leq
-
leq
assert (d0 <= d1) -
leq
-
gt
assert (c0 > c1) -
gt
-
gt
assert (b0 > b1) -
gt
-
gt
assert (s0 > s1) -
gt
-
gt
assert (i0 > i1) -
gt
-
gt
assert (l0 > l1) -
gt
-
gt
assert (f0 > f1) -
gt
-
gt
assert (d0 > d1) -
gt
-
geq
assert (c0 >= c1) -
geq
-
geq
assert (b0 >= b1) -
geq
-
geq
assert (s0 >= s1) -
geq
-
geq
assert (i0 >= i1) -
geq
-
geq
assert (l0 >= l1) -
geq
-
geq
assert (f0 >= f1) -
geq
-
geq
assert (d0 >= d1) -
geq
-
eqFalse
assert (b == false) -
neqFalse
assert (b != false) -
eqTrue
assert (b == true) -
neqTrue
assert (b != true) -
eqZero
assert (c == 0) -
eqZero
assert (b == 0) -
eqZero
assert (s == 0) -
eqZero
assert (i == 0) -
eqZero
assert (l == 0) -
eqZero
assert (f == 0) -
eqZero
assert (d == 0) -
neqZero
assert (c != 0) -
neqZero
assert (b != 0) -
neqZero
assert (s != 0) -
neqZero
assert (i != 0) -
neqZero
assert (l != 0) -
neqZero
assert (f != 0) -
neqZero
assert (d != 0) -
ltZero
assert (b < 0) -
ltZero
assert (s < 0) -
ltZero
assert (i < 0) -
ltZero
assert (l < 0) -
ltZero
assert (f < 0) -
ltZero
assert (d < 0) -
leqZero
assert (b <= 0) -
leqZero
assert (s <= 0) -
leqZero
assert (i <= 0) -
leqZero
assert (l <= 0) -
leqZero
assert (f <= 0) -
leqZero
assert (d <= 0) -
gtZero
assert (b > 0) -
gtZero
assert (s > 0) -
gtZero
assert (i > 0) -
gtZero
assert (l > 0) -
gtZero
assert (f > 0) -
gtZero
assert (d > 0) -
geqZero
assert (b >= 0) -
geqZero
assert (s >= 0) -
geqZero
assert (i >= 0) -
geqZero
assert (l >= 0) -
geqZero
assert (f >= 0) -
geqZero
assert (d >= 0) -
eq
assert (o0 == o1) -
eq
-
neq
assert (o0 != o1) -
neq
-
eqNull
assert (o == null) -
neqNull
assert (o != null) -
eqNaN
assert (Double.isNaN(d)) -
neqNaN
assert (!Double.isNaN(d) -
equals
assert (o0 != null && o1 != null && o0.equals(o1)) -
equals
assert (o0 != null && o1 != null && o0.equals(o1)) -
nullSafeEquals
assert ((o0 == null && o1 == null) || (o0 != null && o0.equals(o1))) -
notEquals
assert (o0 != null && o1 != null && !o0.equals(o1)) -
notEquals
assert (o0 != null && o1 != null && !o0.equals(o1)) -
nonempty
assert (s != null && s.length() > 0) -
neverInvoked
public static <TYPE> TYPE neverInvoked(TYPE t1, TYPE t2)
-