Java Assert assertMandatoryParameter(boolean assertion, String parameterName)

Here you can find the source of assertMandatoryParameter(boolean assertion, String parameterName)

Description

assert Mandatory Parameter

License

Apache License

Declaration

public static void assertMandatoryParameter(boolean assertion, String parameterName) 

Method Source Code

//package com.java2s;
/*/*w w  w .j  av a  2s . c  o m*/
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    public static void assertMandatoryParameter(boolean assertion, String parameterName) {
        if (!assertion) {
            throw new IllegalArgumentException(parameterName + " must be set");
        }
    }
}

Related

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