Java tutorial
//package com.java2s; public class Main { /** * Will throw AssertionError, if expression is not true * * @param expression result of your asserted condition * @param failedMessage message to be included in error log * @throws java.lang.AssertionError */ public static void asserts(final boolean expression, final String failedMessage) { if (!expression) { throw new AssertionError(failedMessage); } } }