Class Assert

java.lang.Object
io.deephaven.base.verify.Assert

public final class Assert extends Object
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 Details

    • setOnAssertionCallback

      public static boolean setOnAssertionCallback(Consumer<AssertionFailure> newCallback)
    • assertion

      public static void assertion(boolean condition, String conditionText)
      assert (condition, conditionText)
    • assertion

      public static void assertion(boolean condition, String conditionText, String detailMessage)
      assert (condition, conditionText, detailMessage)
    • assertion

      public static void assertion(boolean condition, String conditionText, Object o0, String name0)
      assert (condition, conditionText, Object o0, String name0, ... )
    • assertion

      public static void assertion(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1)
    • assertion

      public static void assertion(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2)
    • assertion

      public static void assertion(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, int i2, String name2)
    • assertion

      public static void assertion(boolean condition, String conditionText, Object o0, String name0, Object o1, String name1, Object o2, String name2, Object o3, String name3)
    • assertion

      public static void assertion(boolean condition, String conditionText, boolean b0, String name0)
      assert (condition, conditionText, boolean b0, String name0, ... )
    • assertion

      public static void assertion(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1)
    • assertion

      public static void assertion(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2)
    • assertion

      public static void assertion(boolean condition, String conditionText, boolean b0, String name0, boolean b1, String name1, boolean b2, String name2, boolean b3, String name3)
    • assertion

      public static void assertion(boolean condition, String conditionText, int i0, String name0)
      assert (condition, conditionText, int i0, String name0, ... )
    • assertion

      public static void assertion(boolean condition, String conditionText, int i0, String name0, int i1, String name1)
    • statementNeverExecuted

      public static AssertionFailure statementNeverExecuted()
      assert (this statement is never executed)
    • statementNeverExecuted

      public static AssertionFailure statementNeverExecuted(String statementDescription)
      assert (statementDescription is never executed)
    • exceptionNeverCaught

      public static AssertionFailure exceptionNeverCaught(Exception e)
      assert (this exception is never caught, Exception e)
    • exceptionNeverCaught

      public static AssertionFailure exceptionNeverCaught(String tryStatementDescription, Exception e)
      assert (tryStatementDescription succeeds, Exception e)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(Object o, String name)
      assert (this value never occurs, Object o, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(boolean b, String name)
      assert (this value never occurs, boolean b, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(char c, String name)
      assert (this value never occurs, char c, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(byte b, String name)
      assert (this value never occurs, byte b, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(short s, String name)
      assert (this value never occurs, short s, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(int i, String name)
      assert (this value never occurs, int i, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(long l, String name)
      assert (this value never occurs, long l, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(float f, String name)
      assert (this value never occurs, float f, name)
    • valueNeverOccurs

      public static AssertionFailure valueNeverOccurs(double d, String name)
      assert (this value never occurs, double d, name)
    • eq

      public static void eq(boolean b0, String name0, boolean b1, String name1)
      assert (b0 == b1)
    • eq

      public static void eq(boolean b0, String name0, boolean b1)
    • eq

      public static void eq(char c0, String name0, char c1, String name1)
      assert (c0 == c1)
    • eq

      public static void eq(char c0, String name0, char c1)
    • eq

      public static void eq(byte b0, String name0, byte b1, String name1)
      assert (b0 == b1)
    • eq

      public static void eq(byte b0, String name0, byte b1)
    • eq

      public static void eq(short s0, String name0, short s1, String name1)
      assert (s0 == s1)
    • eq

      public static void eq(short s0, String name0, short s1)
    • eq

      public static void eq(int i0, String name0, int i1, String name1)
      assert (i0 == i1)
    • eq

      public static void eq(int i0, String name0, int i1)
    • eq

      public static void eq(long l0, String name0, long l1, String name1)
      assert (l0 == l1)
    • eq

      public static void eq(long l0, String name0, long l1)
    • eq

      public static void eq(float f0, String name0, float f1, String name1)
      assert (f0 == f1)
    • eq

      public static void eq(float f0, String name0, float f1)
    • eq

      public static void eq(double d0, String name0, double d1, String name1)
      assert (d0 == d1)
    • eq

      public static void eq(double d0, String name0, double d1)
    • neq

      public static void neq(boolean b0, String name0, boolean b1, String name1)
      assert (b0 != b1)
    • neq

      public static void neq(boolean b0, String name0, boolean b1)
    • neq

      public static void neq(char c0, String name0, char c1, String name1)
      assert (c0 != c1)
    • neq

      public static void neq(char c0, String name0, char c1)
    • neq

      public static void neq(byte b0, String name0, byte b1, String name1)
      assert (b0 != b1)
    • neq

      public static void neq(byte b0, String name0, byte b1)
    • neq

      public static void neq(short s0, String name0, short s1, String name1)
      assert (s0 != s1)
    • neq

      public static void neq(short s0, String name0, short s1)
    • neq

      public static void neq(int i0, String name0, int i1, String name1)
      assert (i0 != i1)
    • neq

      public static void neq(int i0, String name0, int i1)
    • neq

      public static void neq(long l0, String name0, long l1, String name1)
      assert (l0 != l1)
    • neq

      public static void neq(long l0, String name0, long l1)
    • neq

      public static void neq(float f0, String name0, float f1, String name1)
      assert (f0 != f1)
    • neq

      public static void neq(float f0, String name0, float f1)
    • neq

      public static void neq(double d0, String name0, double d1, String name1)
      assert (d0 != d1)
    • neq

      public static void neq(double d0, String name0, double d1)
    • lt

      public static void lt(char c0, String name0, char c1, String name1)
      assert (c0 < c1)
    • lt

      public static void lt(char c0, String name0, char c1)
    • lt

      public static void lt(byte b0, String name0, byte b1, String name1)
      assert (b0 < b1)
    • lt

      public static void lt(byte b0, String name0, byte b1)
    • lt

      public static void lt(short s0, String name0, short s1, String name1)
      assert (s0 < s1)
    • lt

      public static void lt(short s0, String name0, short s1)
    • lt

      public static void lt(int i0, String name0, int i1, String name1)
      assert (i0 < i1)
    • lt

      public static void lt(int i0, String name0, int i1)
    • lt

      public static void lt(long l0, String name0, long l1, String name1)
      assert (l0 < l1)
    • lt

      public static void lt(long l0, String name0, long l1)
    • lt

      public static void lt(float f0, String name0, float f1, String name1)
      assert (f0 < f1)
    • lt

      public static void lt(float f0, String name0, float f1)
    • lt

      public static void lt(double d0, String name0, double d1, String name1)
      assert (d0 < d1)
    • lt

      public static void lt(double d0, String name0, double d1)
    • leq

      public static void leq(char c0, String name0, char c1, String name1)
      assert (c0 <= c1)
    • leq

      public static void leq(char c0, String name0, char c1)
    • leq

      public static void leq(byte b0, String name0, byte b1, String name1)
      assert (b0 <= b1)
    • leq

      public static void leq(byte b0, String name0, byte b1)
    • leq

      public static void leq(short s0, String name0, short s1, String name1)
      assert (s0 <= s1)
    • leq

      public static void leq(short s0, String name0, short s1)
    • leq

      public static void leq(int i0, String name0, int i1, String name1)
      assert (i0 <= i1)
    • leq

      public static void leq(int i0, String name0, int i1)
    • leq

      public static void leq(long l0, String name0, long l1, String name1)
      assert (l0 <= l1)
    • leq

      public static void leq(long l0, String name0, long l1)
    • leq

      public static void leq(float f0, String name0, float f1, String name1)
      assert (f0 <= f1)
    • leq

      public static void leq(float f0, String name0, float f1)
    • leq

      public static void leq(double d0, String name0, double d1, String name1)
      assert (d0 <= d1)
    • leq

      public static void leq(double d0, String name0, double d1)
    • gt

      public static void gt(char c0, String name0, char c1, String name1)
      assert (c0 > c1)
    • gt

      public static void gt(char c0, String name0, char c1)
    • gt

      public static void gt(byte b0, String name0, byte b1, String name1)
      assert (b0 > b1)
    • gt

      public static void gt(byte b0, String name0, byte b1)
    • gt

      public static void gt(short s0, String name0, short s1, String name1)
      assert (s0 > s1)
    • gt

      public static void gt(short s0, String name0, short s1)
    • gt

      public static void gt(int i0, String name0, int i1, String name1)
      assert (i0 > i1)
    • gt

      public static void gt(int i0, String name0, int i1)
    • gt

      public static void gt(long l0, String name0, long l1, String name1)
      assert (l0 > l1)
    • gt

      public static void gt(long l0, String name0, long l1)
    • gt

      public static void gt(float f0, String name0, float f1, String name1)
      assert (f0 > f1)
    • gt

      public static void gt(float f0, String name0, float f1)
    • gt

      public static void gt(double d0, String name0, double d1, String name1)
      assert (d0 > d1)
    • gt

      public static void gt(double d0, String name0, double d1)
    • geq

      public static void geq(char c0, String name0, char c1, String name1)
      assert (c0 >= c1)
    • geq

      public static void geq(char c0, String name0, char c1)
    • geq

      public static void geq(byte b0, String name0, byte b1, String name1)
      assert (b0 >= b1)
    • geq

      public static void geq(byte b0, String name0, byte b1)
    • geq

      public static void geq(short s0, String name0, short s1, String name1)
      assert (s0 >= s1)
    • geq

      public static void geq(short s0, String name0, short s1)
    • geq

      public static void geq(int i0, String name0, int i1, String name1)
      assert (i0 >= i1)
    • geq

      public static void geq(int i0, String name0, int i1)
    • geq

      public static void geq(long l0, String name0, long l1, String name1)
      assert (l0 >= l1)
    • geq

      public static void geq(long l0, String name0, long l1)
    • geq

      public static void geq(float f0, String name0, float f1, String name1)
      assert (f0 >= f1)
    • geq

      public static void geq(float f0, String name0, float f1)
    • geq

      public static void geq(double d0, String name0, double d1, String name1)
      assert (d0 >= d1)
    • geq

      public static void geq(double d0, String name0, double d1)
    • eqFalse

      public static void eqFalse(boolean b, String name)
      assert (b == false)
    • neqFalse

      public static void neqFalse(boolean b, String name)
      assert (b != false)
    • eqTrue

      public static void eqTrue(boolean b, String name)
      assert (b == true)
    • neqTrue

      public static void neqTrue(boolean b, String name)
      assert (b != true)
    • eqZero

      public static void eqZero(char c, String name)
      assert (c == 0)
    • eqZero

      public static void eqZero(byte b, String name)
      assert (b == 0)
    • eqZero

      public static void eqZero(short s, String name)
      assert (s == 0)
    • eqZero

      public static void eqZero(int i, String name)
      assert (i == 0)
    • eqZero

      public static void eqZero(long l, String name)
      assert (l == 0)
    • eqZero

      public static void eqZero(float f, String name)
      assert (f == 0)
    • eqZero

      public static void eqZero(double d, String name)
      assert (d == 0)
    • neqZero

      public static void neqZero(char c, String name)
      assert (c != 0)
    • neqZero

      public static void neqZero(byte b, String name)
      assert (b != 0)
    • neqZero

      public static void neqZero(short s, String name)
      assert (s != 0)
    • neqZero

      public static void neqZero(int i, String name)
      assert (i != 0)
    • neqZero

      public static void neqZero(long l, String name)
      assert (l != 0)
    • neqZero

      public static void neqZero(float f, String name)
      assert (f != 0)
    • neqZero

      public static void neqZero(double d, String name)
      assert (d != 0)
    • ltZero

      public static void ltZero(byte b, String name)
      assert (b < 0)
    • ltZero

      public static void ltZero(short s, String name)
      assert (s < 0)
    • ltZero

      public static void ltZero(int i, String name)
      assert (i < 0)
    • ltZero

      public static void ltZero(long l, String name)
      assert (l < 0)
    • ltZero

      public static void ltZero(float f, String name)
      assert (f < 0)
    • ltZero

      public static void ltZero(double d, String name)
      assert (d < 0)
    • leqZero

      public static void leqZero(byte b, String name)
      assert (b <= 0)
    • leqZero

      public static void leqZero(short s, String name)
      assert (s <= 0)
    • leqZero

      public static void leqZero(int i, String name)
      assert (i <= 0)
    • leqZero

      public static void leqZero(long l, String name)
      assert (l <= 0)
    • leqZero

      public static void leqZero(float f, String name)
      assert (f <= 0)
    • leqZero

      public static void leqZero(double d, String name)
      assert (d <= 0)
    • gtZero

      public static void gtZero(byte b, String name)
      assert (b > 0)
    • gtZero

      public static void gtZero(short s, String name)
      assert (s > 0)
    • gtZero

      public static void gtZero(int i, String name)
      assert (i > 0)
    • gtZero

      public static void gtZero(long l, String name)
      assert (l > 0)
    • gtZero

      public static void gtZero(float f, String name)
      assert (f > 0)
    • gtZero

      public static void gtZero(double d, String name)
      assert (d > 0)
    • geqZero

      public static void geqZero(byte b, String name)
      assert (b >= 0)
    • geqZero

      public static void geqZero(short s, String name)
      assert (s >= 0)
    • geqZero

      public static void geqZero(int i, String name)
      assert (i >= 0)
    • geqZero

      public static void geqZero(long l, String name)
      assert (l >= 0)
    • geqZero

      public static void geqZero(float f, String name)
      assert (f >= 0)
    • geqZero

      public static void geqZero(double d, String name)
      assert (d >= 0)
    • eq

      public static void eq(Object o0, String name0, Object o1, String name1)
      assert (o0 == o1)
    • eq

      public static void eq(Object o0, String name0, Object o1)
    • neq

      public static void neq(Object o0, String name0, Object o1, String name1)
      assert (o0 != o1)
    • neq

      public static void neq(Object o0, String name0, Object o1)
    • eqNull

      public static void eqNull(Object o, String name)
      assert (o == null)
    • neqNull

      public static void neqNull(Object o, String name)
      assert (o != null)
    • eqNaN

      public static void eqNaN(double d, String name)
      assert (Double.isNaN(d))
    • neqNaN

      public static void neqNaN(double d, String name)
      assert (!Double.isNaN(d)
    • equals

      public static void equals(Object o0, String name0, Object o1, String name1)
      assert (o0 != null && o1 != null && o0.equals(o1))
    • equals

      public static void equals(Object o0, String name0, Object o1)
      assert (o0 != null && o1 != null && o0.equals(o1))
    • nullSafeEquals

      public static void nullSafeEquals(Object o0, String name0, Object o1, String name1)
      assert ((o0 == null && o1 == null) || (o0 != null && o0.equals(o1)))
    • notEquals

      public static void notEquals(Object o0, String name0, Object o1, String name1)
      assert (o0 != null && o1 != null && !o0.equals(o1))
    • notEquals

      public static void notEquals(Object o0, String name0, Object o1)
      assert (o0 != null && o1 != null && !o0.equals(o1))
    • nonempty

      public static void nonempty(String s, String name)
      assert (s != null && s.length() > 0)
    • neverInvoked

      public static <TYPE> TYPE neverInvoked(TYPE t1, TYPE t2)