Java Assert assertLongPositive(long val, String name)

Here you can find the source of assertLongPositive(long val, String name)

Description

Check if the given long value is positive.

License

Open Source License

Parameter

Parameter Description
val the given long value to check.
name the name to identify the long value.

Exception

Parameter Description
IllegalArgumentException if the given long value is negative or zero.

Declaration

static void assertLongPositive(long val, String name) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w  ww . jav a  2s . c om*/
     * Check if the given long value is positive.
     *
     * @param val the given long value to check.
     * @param name the name to identify the long value.
     * @throws IllegalArgumentException if the given long value is negative or zero.
     */
    static void assertLongPositive(long val, String name) {
        if (val <= 0) {
            throw new IllegalArgumentException(name + " [" + val
                    + "] should be positive.");
        }
    }
}

Related

  1. assertIsProb(double x)
  2. assertIsProbability(final double probability)
  3. assertIsProperlyQuoted(String header, String tag)
  4. assertIsReady()
  5. assertLegal(Object underAssertion, String message)
  6. assertMandatoryParameter(boolean assertion, String parameterName)
  7. assertMatches(String name, String regExp, String actual)
  8. assertMergeTestPostcondition(double[] arr, long[] brr, int arrLen)
  9. assertMessageEquals(Throwable ex, String msg)