See: Description
Class | Description |
---|---|
CCSMAssert |
This class provides simple methods to implement assertions.
|
To understand the difference between preconditions and assertions it is important do differentiate between the developer of a component (class, method, ...) and the user of this component.
Preconditions are used to signal violations of the usage
contract of components to its user. These preconditions are
usually documented as part of the component's comment.
Examples: "Argument may not
be null
", "Argument must be positive",
"cannot call x
for empty list". Preconditions are checked
using the methods of the org.conqat.lib.commons.assertion.CCSMPre
class. Violations are signaled with
org.conqat.lib.commons.assertion.PreconditionException
s.
Assertions are used to check that invariants that only the
developer of component knows are valid. These are used to check for
implementation (opposed to usage) faults.
Examples are: "Stack size
cannot be negative.", "Array index must not be greater than array length".
Assertions are checked
using the methods of the CCSMAssert
class. Violations are signaled with
AssertionError
s.