List of utility methods to do Assert Not Null
void | assertNotNull(Object... params) Check that object is not null. if (params != null) { for (int idx = 0; idx < params.length; idx++) { Object currentparam = params[idx]; if (null == currentparam) { throw new IllegalArgumentException( "[Assertion failed] - Parameter #" + idx + "(object) must not be null"); |
void | assertNotNull(Object... params) Check that object is not null. assertNotNull("parameter", params);
|
void | assertNotNull(String errorMessage, Object... args) assert Not Null if (args == null || args.length == 0) { throw new IllegalArgumentException("Nie podano argumentow do ewaluacji"); for (Object s : args) { if (s == null) { throw new IllegalArgumentException("Argument nie moze byc nullem"); |
void | assertNotNull(String fieldName, Object object) assert Not Null return;
|
void | assertNotNull(String message, Object object) Asserts that an object isn't null. assertTrue(message, object != null); |
void | assertNotNull(String message, Object val) assert Not Null if (message != null) assert val != null : message; else assert val != null; |
Object | assertNotNull(String variableName, Object value) Method throws NullPointerException when the variable named variableName has a null value. if (value == null) throw new NullPointerException("The variable named " + variableName + " is null."); return value; |
void | assertNotNull(StringBuilder buffer) assert Not Null if (buffer == null) { throw new NullPointerException("The buffer cannot be null"); |
void | assertNotNull(T exception, Object... objects) assert Not Null for (Object object : objects) { if (object == null) { throw exception; |
T | assertNotNull(T o) assert Not Null if (o == null) { throw new AssertionError("A reference was unexpectedly null."); return o; |