package finiteAutomata; /** * Provides basic assertion testing for pre-conditions. *

* An assertion is a condition that is expected to be true at a certain * point in the code. Selective testing of method pre-conditions should * reduce programming errors and simplify debugging. * * @author Barbara Wahl (adapted from Duane A. Bailey's code) * @version Fall 2007 */ public class Assert { /** * Performs a verification of the condition, and does nothing if the condition holds. * @param test a boolean expression for the condition to be tested * @param message an English description of the condition * @post Performs a verification of the condition, and does nothing if the condition holds. * If the condition fails, the assertion throws an exception and prints the associated * message, describing the condition that failed. */ static public void pre(boolean test, String message) { if (test == false) throw new FailedPrecondition(message); } }