|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.ops4j.lang.PostConditionException
public class PostConditionException
PostConditionException is used to validate computed results in methods and if not within the supported ranges, throw an appropriate exception describing the problem.
This Exception is used to make the code more robust by ensuring that the output is within the predicted ranges.
Constructor Summary | |
---|---|
PostConditionException(String message)
PostCondition constructor. |
Method Summary | |
---|---|
static void |
validateEqualTo(double value,
double condition,
String identifier)
Validates that the value under test is a particular value. |
static void |
validateEqualTo(long value,
long condition,
String identifier)
Validates that the value under test is a particular value. |
static void |
validateEqualTo(Number value,
Number condition,
String identifier)
Validates that the value under test is a particular value. |
static void |
validateGreaterThan(double value,
double limit,
String identifier)
Validates that the value is greater than a limit. |
static void |
validateGreaterThan(long value,
long limit,
String identifier)
Validates that the value is greater than a limit. |
static void |
validateGreaterThan(Number value,
Number limit,
String identifier)
Validates that the value is greater than a limit. |
static void |
validateLesserThan(double value,
double limit,
String identifier)
Validates that the value is lesser than a limit. |
static void |
validateLesserThan(long value,
long limit,
String identifier)
Validates that the value is lesser than a limit. |
static void |
validateLesserThan(Number value,
Number limit,
String identifier)
Validates that the value is lesser than a limit. |
static void |
validateNotNull(Object object,
String identifier)
Validates that the object is not null. |
static void |
validateNull(Object object,
String identifier)
Validates that the object is null. |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PostConditionException(String message)
message
- The composed error message.Method Detail |
---|
public static void validateNotNull(Object object, String identifier) throws PostConditionException
object
- The object to be validated.identifier
- The name of the object.
PostConditionException
- if the object is null.public static void validateNull(Object object, String identifier) throws PostConditionException
object
- The object to be validated.identifier
- The name of the object.
PostConditionException
- if the object is not null.public static void validateGreaterThan(long value, long limit, String identifier) throws PostConditionException
value > limit
.
identifier
- The name of the object.limit
- The limit that the value must exceed.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateGreaterThan(double value, double limit, String identifier) throws PostConditionException
value > limit
.
identifier
- The name of the object.limit
- The limit that the value must exceed.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateGreaterThan(Number value, Number limit, String identifier) throws PostConditionException
value > limit
.
identifier
- The name of the object.limit
- The limit that the value must exceed.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateLesserThan(long value, long limit, String identifier) throws PostConditionException
value < limit
.
identifier
- The name of the object.limit
- The limit that the value must be smaller than.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateLesserThan(double value, double limit, String identifier) throws PostConditionException
value < limit
.
identifier
- The name of the object.limit
- The limit that the value must be smaller than.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateLesserThan(Number value, Number limit, String identifier) throws PostConditionException
value < limit
.
identifier
- The name of the object.limit
- The limit that the value must be smaller than.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateEqualTo(long value, long condition, String identifier) throws PostConditionException
value == condition
.
identifier
- The name of the object.condition
- The condition value.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateEqualTo(double value, double condition, String identifier) throws PostConditionException
value == condition
.
identifier
- The name of the object.condition
- The condition value.value
- The value to be tested.
PostConditionException
- if the condition is not met.public static void validateEqualTo(Number value, Number condition, String identifier) throws PostConditionException
value == condition
.
identifier
- The name of the object.condition
- The condition value.value
- The value to be tested.
PostConditionException
- if the condition is not met.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |