Class Checks

java.lang.Object
org.junit.internal.Checks

public final class Checks extends Object
Since:
4.13
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    notNull(T value)
    Checks that the given value is not null.
    static <T> T
    notNull(T value, String message)
    Checks that the given value is not null, using the given message as the exception message if an exception is thrown.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Checks

      private Checks()
  • Method Details

    • notNull

      public static <T> T notNull(T value)
      Checks that the given value is not null.
      Parameters:
      value - object reference to check
      Returns:
      the passed-in value, if not null
      Throws:
      NullPointerException - if value is null
    • notNull

      public static <T> T notNull(T value, String message)
      Checks that the given value is not null, using the given message as the exception message if an exception is thrown.
      Parameters:
      value - object reference to check
      message - message to use if value is null
      Returns:
      the passed-in value, if not null
      Throws:
      NullPointerException - if value is null