|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccc.api.types.DBC
public final class DBC
A helper class to support design-by-contract (DBC).
Method Summary | ||
---|---|---|
void |
containsNoBrackets(java.lang.String stringToTest)
Assert that the specified string does not contain bracket < > characters. |
|
static DBC |
ensure()
Factory method. |
|
int |
greaterThan(int criteria,
int value)
Assert that the specified value is greater than the criteria. |
|
void |
maxLength(java.lang.String stringToTest,
int maximumLength)
Assert that the specified string is not longer than the specified length. |
|
void |
maxOccurrences(java.lang.String text,
java.lang.String item,
int max)
Assert that the specified string does not occur more than specified in the text. |
|
void |
maxValue(long valueToTest,
long maximum)
Assert that the specified value is less than the criteria. |
|
void |
minLength(java.lang.String stringToTest,
int minimumLength)
Assert that the specified string contains at least the specified number of characters. |
|
void |
minValue(long valueToTest,
long minimum)
Assert that the specified value is greater than the criteria. |
|
java.lang.String |
notEmpty(java.lang.String string)
Assert that the specified string is not empty. |
|
|
notNull(T object)
Assert that the specified value is not null. |
|
static DBC |
require()
Factory method. |
|
void |
toBeFalse(boolean condition)
Assert that the specified condition is false. |
|
void |
toBeNull(java.lang.Object object)
Assert that the specified object is null. |
|
void |
toBeTrue(boolean condition)
Assert that the specified condition is true. |
|
void |
toBeTrue(boolean condition,
java.lang.String message)
Assert that the specified condition is true. |
|
void |
toMatch(java.lang.String regex,
java.lang.String stringToTest)
Assert that the specified string matches with given regular expression. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static DBC require()
public static DBC ensure()
public <T> T notNull(T object)
T
- The type object to be checked.object
- The object to test for NULL.
public java.lang.String notEmpty(java.lang.String string)
string
- The string that may not be empty.
public void toBeFalse(boolean condition)
condition
- The condition to check.public void toBeTrue(boolean condition)
condition
- The condition to check.public void toBeTrue(boolean condition, java.lang.String message)
condition
- The condition to check.message
- The error message.public void maxLength(java.lang.String stringToTest, int maximumLength)
stringToTest
- The string to test.maximumLength
- The length it should not exceed.public void minLength(java.lang.String stringToTest, int minimumLength)
stringToTest
- The string to test.minimumLength
- The minimal acceptable length.public void toMatch(java.lang.String regex, java.lang.String stringToTest)
regex
- The regular expression.stringToTest
- The string to test.public void toBeNull(java.lang.Object object)
object
- The object to test.public void containsNoBrackets(java.lang.String stringToTest)
stringToTest
- The string to test.public void maxValue(long valueToTest, long maximum)
valueToTest
- The value to test.maximum
- The maximum acceptable value.public void minValue(long valueToTest, long minimum)
valueToTest
- The value to test.minimum
- The minimum acceptable value.public int greaterThan(int criteria, int value)
criteria
- The lower bound.value
- The value to test.public void maxOccurrences(java.lang.String text, java.lang.String item, int max)
text
- The text to validate.item
- The string to search.max
- The maximum occurrences.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |