Class AssertValue

java.lang.Object
org.ek9lang.core.AssertValue

public class AssertValue extends Object
Used as simple one-liners to check a value and issue an illegal argument exception if empty.
  • Method Details

    • checkRange

      public static void checkRange(String messageIfOutside, Integer valueToCheck, Integer min, Integer max)
      A check on range of value.
    • checkNotNull

      public static void checkNotNull(String messageIfNull, Object valueToCheck)
      Not null of exception error.
    • checkCanReadFile

      public static void checkCanReadFile(String messageIfNoRead, String fileName)
      Check filename valid and file can be read.
    • checkCanReadFile

      public static void checkCanReadFile(String messageIfNoRead, File file)
      Check file not null valid and file can be read.
    • checkDirectoryReadable

      public static void checkDirectoryReadable(String messageIfNoRead, String directoryName)
      Check directory name valid and directory can be read.
    • checkDirectoryReadable

      public static void checkDirectoryReadable(String messageIfNoRead, File dir)
      Check directory name valid and directory can be read.
    • checkDirectoryWritable

      public static void checkDirectoryWritable(String messageIfNoWrite, String directoryName)
      Check directory name valid and directory can be written to.
    • checkDirectoryWritable

      public static void checkDirectoryWritable(String messageIfNoWrite, File dir)
      Check directory name valid and directory can be written to.
    • checkNotEmpty

      public static void checkNotEmpty(String messageIfEmpty, Optional<?> item)
      Check item not null and not empty.
    • checkNotEmpty

      public static void checkNotEmpty(String messageIfEmpty, String valueToCheck)
      Checks if a string value is null or an empty string and if so issues an illegal argument exception.
      Parameters:
      valueToCheck - The value to check.
    • checkNotEmpty

      public static void checkNotEmpty(String messageIfEmpty, String[] valuesToCheck)
      Checks if a string values is null or empty strings and if so issues an illegal argument exception.
      Parameters:
      valuesToCheck - The values to check.
    • checkNotEmpty

      public static void checkNotEmpty(String messageIfEmpty, Collection<?> items)
      Checks if a collection of items is null or empty and if so issues an illegal argument exception.
      Parameters:
      items - The values to check.
    • checkTrue

      public static void checkTrue(String messageIfFalse, boolean value)
      Assets that a value is true or illegal argument exception.
    • checkFalse

      public static void checkFalse(String messageIfTrue, boolean value)
      Asserts that the value is false, illegal argument exception if not.
    • fail

      public static void fail(String withMessage)
      Just trigger a direct failure.
      Parameters:
      withMessage - The message to issue.