Class Assert

Hierarchy: Object , Assert
public class Assert
A utility for making programming assertions.

Other

  • version: 1.7
public static void isTrue(boolean assertion)
Throws an AssertionFailedException if the given assertion is not true.
Parameters:
assertion - assertion a condition that is supposed to be true
Throws:
AssertionFailedException - AssertionFailedException if the condition is false
public static void isTrue(boolean assertion, String message)
Throws an AssertionFailedException with the given message if the given assertion is not true.
Parameters:
assertion - assertion a condition that is supposed to be true
message - message a description of the assertion
Throws:
AssertionFailedException - AssertionFailedException if the condition is false
public static void equals(Object expectedValue, Object actualValue)
Throws an AssertionFailedException if the given objects are not equal, according to the equals method.
Parameters:
expectedValue - expectedValue the correct value
actualValue - actualValue the value being checked
Throws:
AssertionFailedException - AssertionFailedException if the two objects are not equal
public static void equals(Object expectedValue, Object actualValue, String message)
Throws an AssertionFailedException with the given message if the given objects are not equal, according to the equals method.
Parameters:
expectedValue - expectedValue the correct value
actualValue - actualValue the value being checked
message - message a description of the assertion
Throws:
AssertionFailedException - AssertionFailedException if the two objects are not equal
public static void shouldNeverReachHere()
Always throws an AssertionFailedException.
Throws:
AssertionFailedException - AssertionFailedException thrown always
public static void shouldNeverReachHere(String message)
Always throws an AssertionFailedException with the given message.
Parameters:
message - message a description of the assertion
Throws:
AssertionFailedException - AssertionFailedException thrown always