Class Contracts


  • public final class Contracts
    extends Object
    Author:
    Gunnar Morling, Hardy Ferentschik, Kevin Pollet <kevin.pollet@serli.com> (C) 2012 SERLI
    • Method Detail

      • assertNotNull

        public static void assertNotNull​(Object o)
      • assertNotNull

        public static void assertNotNull​(Object o,
                                         String message)
        Asserts that the given object is not null.
        Parameters:
        o - The object to check.
        message - A message text which will be used as message of the resulting exception if the given object is null.
        Throws:
        IllegalArgumentException - In case the given object is null.
      • assertValueNotNull

        public static void assertValueNotNull​(Object o,
                                              String name)
        Asserts that the given object is not null.
        Parameters:
        o - The object to check.
        name - The name of the value to check. A message of the form "<name> must not be null" will be used as message of the resulting exception if the given object is null.
        Throws:
        IllegalArgumentException - In case the given object is null.
      • assertTrue

        public static void assertTrue​(boolean condition,
                                      String message)
      • assertTrue

        public static void assertTrue​(boolean condition,
                                      String message,
                                      Object... messageParameters)
      • assertNotEmpty

        public static void assertNotEmpty​(String s,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(Collection<?> collection,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(Collection<?> collection,
                                          String message,
                                          Object... messageParameters)
      • assertNotEmpty

        public static void assertNotEmpty​(Object[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(byte[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(short[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(int[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(long[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(float[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(double[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(boolean[] array,
                                          String message)
      • assertNotEmpty

        public static void assertNotEmpty​(char[] array,
                                          String message)