类 Assert


  • public class Assert
    extends java.lang.Object
    A utility for making programming assertions.
    版本:
    1.7
    • 构造器概要

      构造器 
      构造器 说明
      Assert()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static void equals​(java.lang.Object expectedValue, java.lang.Object actualValue)
      Throws an AssertionFailedException if the given objects are not equal, according to the equals method.
      static void equals​(java.lang.Object expectedValue, java.lang.Object actualValue, java.lang.String message)
      Throws an AssertionFailedException with the given message if the given objects are not equal, according to the equals method.
      static void isTrue​(boolean assertion)
      Throws an AssertionFailedException if the given assertion is not true.
      static void isTrue​(boolean assertion, java.lang.String message)
      Throws an AssertionFailedException with the given message if the given assertion is not true.
      static void shouldNeverReachHere()
      Always throws an AssertionFailedException.
      static void shouldNeverReachHere​(java.lang.String message)
      Always throws an AssertionFailedException with the given message.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • Assert

        public Assert()
    • 方法详细资料

      • isTrue

        public static void isTrue​(boolean assertion)
        Throws an AssertionFailedException if the given assertion is not true.
        参数:
        assertion - a condition that is supposed to be true
        抛出:
        AssertionFailedException - if the condition is false
      • isTrue

        public static void isTrue​(boolean assertion,
                                  java.lang.String message)
        Throws an AssertionFailedException with the given message if the given assertion is not true.
        参数:
        assertion - a condition that is supposed to be true
        message - a description of the assertion
        抛出:
        AssertionFailedException - if the condition is false
      • equals

        public static void equals​(java.lang.Object expectedValue,
                                  java.lang.Object actualValue)
        Throws an AssertionFailedException if the given objects are not equal, according to the equals method.
        参数:
        expectedValue - the correct value
        actualValue - the value being checked
        抛出:
        AssertionFailedException - if the two objects are not equal
      • equals

        public static void equals​(java.lang.Object expectedValue,
                                  java.lang.Object actualValue,
                                  java.lang.String message)
        Throws an AssertionFailedException with the given message if the given objects are not equal, according to the equals method.
        参数:
        expectedValue - the correct value
        actualValue - the value being checked
        message - a description of the assertion
        抛出:
        AssertionFailedException - if the two objects are not equal
      • shouldNeverReachHere

        public static void shouldNeverReachHere()
        Always throws an AssertionFailedException.
        抛出:
        AssertionFailedException - thrown always
      • shouldNeverReachHere

        public static void shouldNeverReachHere​(java.lang.String message)
        Always throws an AssertionFailedException with the given message.
        参数:
        message - a description of the assertion
        抛出:
        AssertionFailedException - thrown always