public class ERXAssert extends Object
In your code's static initialization, you can write:ERXAssert.instances=RAISE ERXAssert.instances.com.somepackage=LOG ERXAssert.instances.com.somepackage.someclass=RAISE
And finally, in your methods, you call it via:private static ERXAssert Assert = ERXAssert.getAssert(Foo.class); private static ERXAssert Pre = ERXAssert.PRE; private static ERXAssert Post = ERXAssert.POST;
or you can use the supplied assertors directlyPre.notNull(someObject); Assert.notNull("someObject" ,someObject); Post.notNull(someObject);
Most of this code is derived from Jonathan "Wolf" Rentzsch's JAssert, which can be found here: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/redshed/JAssert/.ERXAssert.DURING.notNull("someObject", someObject);
Modifier and Type | Class and Description |
---|---|
protected static class |
ERXAssert.EmptyHandler |
static interface |
ERXAssert.FailureHandler |
protected static class |
ERXAssert.IllegalArgumentHandler |
protected static class |
ERXAssert.IllegalStateHandler |
protected static class |
ERXAssert.LoggingHandler |
protected static class |
ERXAssert.ThrowingHandler |
Modifier and Type | Field and Description |
---|---|
protected ERXAssert.FailureHandler |
_failureHandler |
protected String |
_name |
static ERXAssert |
DURING |
static ERXAssert |
POST |
static ERXAssert |
PRE |
Modifier and Type | Method and Description |
---|---|
void |
fail(String message) |
void |
fail(String message,
String supplement) |
ERXAssert.FailureHandler |
failureHandler() |
static ERXAssert |
getAssert(Class c) |
static ERXAssert |
getAssert(String name) |
static ERXAssert |
getAssert(String prefix,
Class c) |
protected static String |
getLevel(ERXAssert value) |
void |
greaterThan(double value1,
double value2) |
void |
greaterThan(int value1,
int value2) |
void |
greaterThan(long value1,
long value2) |
void |
greaterThanOrEqual(double value1,
double value2) |
void |
greaterThanOrEqual(int value1,
int value2) |
void |
greaterThanOrEqual(long value1,
long value2) |
void |
isEmpty(String value) |
void |
isEqual(double value1,
double value2) |
void |
isEqual(int value1,
int value2) |
void |
isEqual(long value1,
long value2) |
void |
isEqual(Object value1,
Object value2) |
void |
isEqual(String message,
int value1,
int value2) |
void |
isEqual(String message,
Object value1,
Object value2) |
void |
isFalse(boolean value) |
void |
isFalse(String message,
boolean value) |
void |
isNegative(double value) |
void |
isNegative(int value) |
void |
isNegative(long value) |
void |
isNull(Object value) |
void |
isNull(String message,
Object value) |
void |
isPositive(double value) |
void |
isPositive(int value) |
void |
isPositive(long value) |
void |
isTrue(boolean value) |
void |
isTrue(String message,
boolean value) |
void |
isZero(double value) |
void |
isZero(int value) |
void |
isZero(long value) |
void |
lessThan(double value1,
double value2) |
void |
lessThan(int value1,
int value2) |
void |
lessThan(long value1,
long value2) |
void |
lessThanOrEqual(double value1,
double value2) |
void |
lessThanOrEqual(int value1,
int value2) |
void |
lessThanOrEqual(long value1,
long value2) |
String |
name() |
void |
notEmpty(String value) |
void |
notEqual(double value1,
double value2) |
void |
notEqual(int value1,
int value2) |
void |
notEqual(long value1,
long value2) |
void |
notEqual(Object value1,
Object value2) |
void |
notNegative(double value) |
void |
notNegative(int value) |
void |
notNegative(long value) |
void |
notNull(Object value) |
void |
notNull(String message,
Object value) |
void |
notPositive(double value) |
void |
notPositive(int value) |
void |
notPositive(long value) |
void |
notZero(double value) |
void |
notZero(int value) |
void |
notZero(long value) |
void |
setFailureHandler(ERXAssert.FailureHandler handler) |
static void |
setHandlerForLevel(ERXAssert.FailureHandler object,
String level) |
protected static void |
setLevel(ERXAssert value) |
void |
unknownSwitchCase(int value) |
public static final ERXAssert DURING
public static final ERXAssert PRE
public static final ERXAssert POST
protected String _name
protected ERXAssert.FailureHandler _failureHandler
public static void setHandlerForLevel(ERXAssert.FailureHandler object, String level)
protected static void setLevel(ERXAssert value)
public void isTrue(boolean value)
public void isTrue(String message, boolean value)
public void isFalse(boolean value)
public void isFalse(String message, boolean value)
public void isNull(Object value)
public void notNull(Object value)
public void isEmpty(String value)
public void notEmpty(String value)
public void isZero(int value)
public void isZero(long value)
public void isZero(double value)
public void notZero(int value)
public void notZero(long value)
public void notZero(double value)
public void isNegative(int value)
public void isNegative(long value)
public void isNegative(double value)
public void notNegative(int value)
public void notNegative(long value)
public void notNegative(double value)
public void isPositive(int value)
public void isPositive(long value)
public void isPositive(double value)
public void notPositive(int value)
public void notPositive(long value)
public void notPositive(double value)
public void isEqual(int value1, int value2)
public void isEqual(String message, int value1, int value2)
public void isEqual(long value1, long value2)
public void isEqual(double value1, double value2)
public void notEqual(int value1, int value2)
public void notEqual(long value1, long value2)
public void notEqual(double value1, double value2)
public void lessThan(int value1, int value2)
public void lessThan(long value1, long value2)
public void lessThan(double value1, double value2)
public void lessThanOrEqual(int value1, int value2)
public void lessThanOrEqual(long value1, long value2)
public void lessThanOrEqual(double value1, double value2)
public void greaterThan(int value1, int value2)
public void greaterThan(long value1, long value2)
public void greaterThan(double value1, double value2)
public void greaterThanOrEqual(int value1, int value2)
public void greaterThanOrEqual(long value1, long value2)
public void greaterThanOrEqual(double value1, double value2)
public void unknownSwitchCase(int value)
public String name()
public ERXAssert.FailureHandler failureHandler()
public void setFailureHandler(ERXAssert.FailureHandler handler)
public void fail(String message)
Copyright © 2002 – 2024 Project Wonder.