List of utility methods to do Assert
void | assertCheckStrAndQuery(String str, String query) Checks that str is not null, and query is not null, not empty, and is a single word. assert str != null : STR_CANNOT_BE_NULL_MESSAGE; assert query != null : QUERY_CANNOT_BE_NULL_MESSAGE; assert !query.isEmpty() : QUERY_CANNOT_BE_EMPTY_MESSAGE; assert query.split(WHITESPACE_DELIMITER).length == 1 : QUERY_LEN_SHOULD_BE_ONE_MESSAGE; |
void | assertClassDoesNotExist(String className) assert Class Does Not Exist try { Class.forName(className); throw new AssertionError("Expected a class to not exists, but it did: " + className); } catch (ClassNotFoundException e) { |
void | assertClassExists(String className) assert Class Exists try { Class.forName(className); } catch (ClassNotFoundException e) { throw new AssertionError("Expected a class to exists, but it did not: " + className, e); |
void | assertColor(int color) assert Color if (color < 0 || color > 255) { throw new IllegalArgumentException("Color outside of range 0 - 255"); |
boolean | assertComparison(T actual, T expected) assert Comparison boolean ret = false; if ((expected == null) && (actual == null)) { ret = true; } else if (expected != null) { ret = expected.compareTo(actual) == 0; return ret; |
boolean | assertComparison(T actual, T expected) assert the equality of two generic objects using compareTo() operator boolean ret = false; if ((expected == null) && (actual == null)) { ret = true; } else if (expected != null) { ret = expected.compareTo(actual) == 0; return ret; |
void | assertCond(boolean b) assert Cond if (!b) throw new RuntimeException("Assertion violation."); |
void | assertCondition(boolean condition, String message) Assert the provided boolean condition , throwing AssertionError with the supplied message if the test result is false . if (!condition) {
fail(message);
|
void | assertCondition(boolean condition, String msg) assert Condition if (!condition) { throw new InternalError("Assertion failed: " + msg); |
void | assertContains(final String string, final String content) Checks that the expected string occurs within the content string. if (content.indexOf(string) == -1) { throw new AssertionError(content + "' does not contain '" + string + "'"); |