List of utility methods to do Assert
void | assertLongPositive(long val, String name) Check if the given long value is positive. if (val <= 0) { throw new IllegalArgumentException(name + " [" + val + "] should be positive."); |
void | assertMandatoryParameter(boolean assertion, String parameterName) assert Mandatory Parameter if (!assertion) { throw new IllegalArgumentException(parameterName + " must be set"); |
void | assertMatches(String name, String regExp, String actual) assert Matches if (notMatches(regExp, actual)) { throw new AssertionError(name + ": " + actual + " is not matching " + regExp + "!"); |
void | assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen) assert Merge Test Postcondition int violationsCount = 0; for (int i = 0; i < arrLen - 1; i++) { if (arr[i] > arr[i + 1]) { violationsCount++; for (int i = 0; i < arrLen; i++) { if (brr[i] != (long) (1e12 * (1.0 - arr[i]))) ... |
void | assertMessageEquals(Throwable ex, String msg) assert Message Equals if (!msg.equals(ex.getMessage())) { throw new AssertionError( "Exception message should be [" + msg + "], but was [" + ex.getMessage() + "]."); |
String | assertNonEmpty(String s, String name) assert Non Empty if (s == null || s.length() == 0) { throw new IllegalArgumentException(name + " must not be null or empty"); return s; |
void | assertNonFatal(boolean test, String msg) assert Non Fatal if (!test) { Exception e = new Exception(msg); e.printStackTrace(System.out); |
void | assertNonNegative(int field, String fieldName) assert Non Negative if (field < 0) { throw new IllegalArgumentException(fieldName + " must be equal to or greater than zero"); |
void | assertNonZero(int i, String fieldName) assert Non Zero if (i == 0) { throw new IllegalArgumentException(fieldName + " must be non-zero"); |
String | assertNoSlash(final String ofString) assert No Slash if (!ofString.endsWith("/")) { return ofString; return ofString.substring(0, ofString.length() - 1); |