Java Assert assertNonNegative(int field, String fieldName)

Here you can find the source of assertNonNegative(int field, String fieldName)

Description

assert Non Negative

License

Apache License

Declaration

public static void assertNonNegative(int field, String fieldName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static void assertNonNegative(int field, String fieldName) {
        if (field < 0) {
            throw new IllegalArgumentException(fieldName + " must be equal to or greater than zero");
        }/*from  w ww  . jav a 2s .  c  om*/
    }

    public static void assertNonNegative(long field, String fieldName) {
        if (field < 0) {
            throw new IllegalArgumentException(fieldName + " must be equal to or greater than zero");
        }
    }
}

Related

  1. assertMatches(String name, String regExp, String actual)
  2. assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen)
  3. assertMessageEquals(Throwable ex, String msg)
  4. assertNonEmpty(String s, String name)
  5. assertNonFatal(boolean test, String msg)
  6. assertNonZero(int i, String fieldName)
  7. assertNoSlash(final String ofString)
  8. assertNotBlank(final String arg, final String message)
  9. assertNotBlank(final String value, final String exceptionMessage)