Class Assert


  • public final class Assert
    extends java.lang.Object
    Assertions. Contains static methods which take a boolean condition and throw an exception if these conditions do not hold. Useful for debugging and during development.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Assert.AssertionException
      Indicates that an Assert statement has failed.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void assertFalse​(boolean condition)
      Assert that a condition is false.
      static void assertFalse​(java.lang.String reason, boolean condition)
      Assert rhat a condition is false.
      static void assertTrue​(boolean condition)
      Assert that a condition is true.
      static void assertTrue​(java.lang.String reason, boolean condition)
      Assert that a condition is true.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • assertTrue

        public static void assertTrue​(boolean condition)
        Assert that a condition is true.
        Parameters:
        condition - throw an exception if the given condition does not hold
      • assertTrue

        public static void assertTrue​(java.lang.String reason,
                                      boolean condition)
        Assert that a condition is true.
        Parameters:
        reason - why the condition should hold
        condition - throw an exception if the given condition does not hold
      • assertFalse

        public static void assertFalse​(boolean condition)
        Assert that a condition is false.
        Parameters:
        condition - throw an exception if the given condition holds
      • assertFalse

        public static void assertFalse​(java.lang.String reason,
                                       boolean condition)
        Assert rhat a condition is false.
        Parameters:
        reason - why the condition should not hold
        condition - throw an exception if the given condition holds