Example #1
0
 /**
  * Asserts that an object isn't null. If it is, an AssertionFailedError, with the given message,
  * is thrown.
  *
  * @param object the assertion object
  * @param message the assertion error message
  */
 public static void assertNotNull(Object object, String message) {
   if (object == null) {
     String formatted = "";
     if (message != null) {
       formatted = message + " ";
     }
     log.error("assertNotNull : " + message);
     fail(formatted + "expected object to not be null");
   }
   assertTrue(object != null, message);
 }
Example #2
0
 /**
  * Asserts that a condition is true. If it isn't, an AssertionError is thrown if haultonfailure.
  *
  * @param condition the condition to evaluate
  */
 public static void assertTrue(boolean condition) {
   assertTrue(condition, null);
 }