List of utility methods to do Assert
void | assertHasText(String str) assert Has Text if (!hasText(str)) throw new IllegalArgumentException("no text in str"); |
boolean | assertHexOrDecLongValue(String value) assert Hex Or Dec Long Value try { parseHexOrDecLong(value); } catch (NumberFormatException nfe) { return false; return true; |
void | assertInBounds(final String param, final int value, final int min, final int max) Asserts that the specified integer is in the valid range. if (value < min || value > max) { throw new IllegalArgumentException( String.format("The value of the parameter %s should be between %s and %s.", param, min, max)); |
void | assertInBounds(int[] coordinates) assert In Bounds assertWithoutBounds(coordinates); assertInBounds(coordinates[0], coordinates[1]); |
void | assertIndex(final int size, final int index) Make sure the index provided as input is inside the range of possible elements of a list. if (index < 0 || index >= size) { throw new ArrayIndexOutOfBoundsException(); |
int | assertIndex(final String s, final int index) assert Index if (index >= 0) return index; throw new IllegalArgumentException(s); |
void | assertIndex(int index, String msg) Asserts if index is between 0 and 63. if ((index < 0) || (index > 63)) throw new AssertionError(msg); |
String | assertInputNotEmpty(final String input, final String message) assert Input Not Empty if (input == null || input.isEmpty()) { throw new IllegalArgumentException(message); return input; |
void | assertInstance(final Object object, final Class> c) Verifies that the given object is an instance of the given class. assertInstance(object, c, false); |
void | assertInstance(Object object, Class c) assert Instance assertInstance(object, c, false); |