All Packages Class Hierarchy This Package Previous Next Index
Class structure.Assert
java.lang.Object
|
+----structure.Assert
- public class Assert
- extends Object
A class to manage assertion testing.
Assertions (preconditions, postconditions, and others) are tested
by verifying a boolean expression, and throwing an error if the
expression is false. A message is provided to describe the condition
tested.
condition(boolean, String)
- Test a general condition.
fail(String)
- Indicate certain failure.
post(boolean, String)
- Test a postcondition.
pre(boolean, String)
- Test a precondition.
pre
public static void pre(boolean test,
String message)
- Test a precondition. If the assertion fails the message
indicates that a precondition failed. A precondition is something
you require to be true for the method to be executed correctly.
- Precondition:
- Result of precondition test.
- Postcondition:
- Does nothing if test true, otherwise abort w/message
- Parameters:
- test - A boolean expression describing precondition.
- message - A string describing precondition.
post
public static void post(boolean test,
String message)
- Test a postcondition. If the assertion fails, the message
indicates that a postcondition failed. A postcondition is
something expected to be true after a method invocation,
provided the preconditions are met.
- Precondition:
- Result of postcondition test.
- Postcondition:
- Does nothing if test true, otherwise abort w/message
- Parameters:
- test - A boolean expression describing postcondition.
- message - A string describing postcondition.
condition
public static void condition(boolean test,
String message)
- Test a general condition. If the assertion fails, the message
indicates that a general condition failed. The condition may
be anything that needs to be verified during the course of program
execution.
- Precondition:
- Result of general condition test.
- Postcondition:
- Does nothing if test true, otherwise abort w/message
- Parameters:
- test - A boolean expression describing the condition.
- message - A string describing the condition.
fail
public static void fail(String message)
- Indicate certain failure. Stops the program with a message
indicating why failure occurred.
- Postcondition:
- Throws error with message
- Parameters:
- message - A string describing the reason for failure.
All Packages Class Hierarchy This Package Previous Next Index