Here you can find the source of assertNotNull(Object object, String description)
Parameter | Description |
---|---|
object | the text to check |
description | describes the object, used in the exception message |
Parameter | Description |
---|---|
NullPointerException | if object is null |
public static void assertNotNull(Object object, String description)
//package com.java2s; public class Main { /**// ww w. j a v a 2 s . co m * Throws an NPE if the given object is {@code null} that uses * the specified text to describe the object. * * @param object the text to check * @param description describes the object, used in the exception message * * @throws NullPointerException if {@code object} is {@code null} */ public static void assertNotNull(Object object, String description) { if (object == null) { throw new NullPointerException("The " + description + " must not be null."); } } }