Java Assert assertIntegerGreaterThanZero(long number, String name)

Here you can find the source of assertIntegerGreaterThanZero(long number, String name)

Description

Check if the integer is greater than zero.

License

Open Source License

Parameter

Parameter Description
number the integer number to check.
name the integer's name.

Exception

Parameter Description
IllegalArgumentException if the number if less than or equals to zero.

Declaration

static void assertIntegerGreaterThanZero(long number, String name) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  w  w  w  .j a  v a  2s . c om*/
     * Check if the integer is greater than zero.
     * @param number
     *            the integer number to check.
     * @param name
     *            the integer's name.
     * @throws IllegalArgumentException
     *             if the number if less than or equals to zero.
     */
    static void assertIntegerGreaterThanZero(long number, String name) {
        if (number <= 0) {
            throw new IllegalArgumentException(name + " must be positive.");
        }
    }
}

Related

  1. assertInstance(final Object object, final Class c)
  2. assertInstance(Object object, Class c)
  3. assertInstanceOf(Object obj, Class classType)
  4. assertInstanceOf(Object obj, Class expClass)
  5. assertInstanceOf(Object object, Class expectClass)
  6. assertIntegerNotNegative(String message, int num)
  7. assertion(boolean isTrue, String reason)
  8. assertion(boolean value)
  9. assertion(String operator, String expr)