Class Preconditions

java.lang.Object
com.soebes.itf.jupiter.extension.Preconditions

@API(status=INTERNAL, since="0.9.0") public class Preconditions extends Object
Author:
Karl Heinz Marbaise
  • Method Details

    • requireNotNull

      public static <T> T requireNotNull(T parameter, String message)
      Check that the given parameter is not null.
      Parameters:
      parameter - The parameter which is checked not to be null.
      message - The message which is thrown in the exception.
      Returns:
      the given paremter in case not being null.
      Throws:
      IllegalArgumentException - in case of parameter is null.
    • requireGreaterZero

      public static <T> T[] requireGreaterZero(T[] parameter, String message)
      Check that the given array has a length which is greater than zero.
      Type Parameters:
      T - The type of the parameter.
      Parameters:
      parameter - The array parameter of which the length will be checked.
      message - The message to thrown in case of not fulfilling the condition.
      Returns:
      Return the original paramter if not raised the execption.
      Throws:
      IllegalArgumentException - in case the condition has not been fulfilled.
    • requireNotEmpty

      public static String requireNotEmpty(String parameter, String message)
      Check that the given parameter is not empty.
      Parameters:
      parameter - The String parameter which should not be empty.
      message - The message to thrown in case of not fulfilling the condition.
      Returns:
      Return the original parameter if not raised the execption.
      Throws:
      IllegalArgumentException - in case the condition has not been fulfilled.