Java Assert Null assertAllAreNull(String messageIfNull, Object... objects)

Here you can find the source of assertAllAreNull(String messageIfNull, Object... objects)

Description

Asserts that all of the objects are null.

License

Amazon Software License

Parameter

Parameter Description
messageIfNull message.
objects objects.

Exception

Parameter Description
IllegalArgumentException if any object provided was NOT null.

Declaration

public static void assertAllAreNull(String messageIfNull, Object... objects) 

Method Source Code

//package com.java2s;
//License from project: Amazon Software License 

public class Main {
    /**/*from   w  w  w.  j av  a2s  . c  o m*/
     * Asserts that all of the objects are null.
     * @param messageIfNull message.
     * @param objects objects.
     * @throws IllegalArgumentException if any object provided was NOT null.
     */
    public static void assertAllAreNull(String messageIfNull, Object... objects) {
        for (final Object object : objects) {
            if (object != null) {
                throw new IllegalArgumentException(messageIfNull);
            }
        }
    }
}

Related

  1. assertInstance(final Object object, final Class c, final boolean allowNull)
  2. assertIsNull(Object obj)
  3. assertNonNull(final T object, final String paramName)
  4. assertNonNull(String argumentName, Object argument)