All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.conqat.lib.commons.assertion.package.html Maven / Gradle / Ivy

There is a newer version: 2024.7.2
Show newest version




This package provides support for precondition checking and assertions.

Preconditions vs 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 {@link org.conqat.lib.commons.assertion.CCSMPre} class. Violations are signaled with {@link 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 {@link org.conqat.lib.commons.assertion.CCSMAssert} class. Violations are signaled with {@link java.lang.AssertionError}s.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy