Java Assert Not Null assertNotNull(final String message, final Object object)

Here you can find the source of assertNotNull(final String message, final Object object)

Description

assert Not Null

License

LGPL

Declaration

public static void assertNotNull(final String message, final Object object) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static void assertNotNull(final String message, final Object object) {
        assertTrue(message, object != null);
    }/* w  ww .  j  a v  a  2 s  .  c  om*/

    public static void assertNotNull(final Object object) {
        assertNotNull(null, object);
    }

    public static void assertTrue(final String message, final boolean condition) {
        if (!condition) {
            fail(message);
        }
    }

    public static void assertTrue(final boolean condition) {
        assertTrue(null, condition);
    }

    public static void fail(final Object message) {
        if (message == null) {
            throw new AssertionError();
        }

        throw new AssertionError(message);
    }
}

Related

  1. assertNotNull(final Object object, final String message)
  2. assertNotNull(final Object param, final String name)
  3. assertNotNull(final Object value, final String name)
  4. assertNotNull(final Object... objects)
  5. assertNotNull(final String message, final Object obj)
  6. assertNotNull(final String name, final T object)
  7. assertNotNull(final String param, final Object value)
  8. assertNotNull(final T object, final String message)
  9. assertNotNull(final T value, final String param)