+ /**
+ * Check that given {@link Object} is not NULL.
+ *
+ * @param the
+ * error message to display if it is NULL
+ * @param actual
+ * the actual value
+ *
+ * @throws AssertException
+ * in case they differ
+ */
+ public void assertNotNull(String errorMessage, Object actual)
+ throws AssertException {
+ if (actual == null) {
+ String defaultReason = String.format("" //
+ + "Assertion failed!\n" //
+ + "Object should have been NULL: [%s]", actual);
+
+ if (errorMessage == null) {
+ throw new AssertException(defaultReason);
+ } else {
+ throw new AssertException(errorMessage, new AssertException(
+ defaultReason));
+ }
+ }
+ }
+