Java Assert True assertTrue(final boolean condition, final String message)

Here you can find the source of assertTrue(final boolean condition, final String message)

Description

Assert that the statement is true, otherwise throw an exception with the provided message.

License

MIT License

Parameter

Parameter Description
condition the condition to assert is true.
message the message to display if the condition is not true.

Declaration

public static void assertTrue(final boolean condition, final String message) 

Method Source Code

//package com.java2s;
/*/*from   w  ww.  j  a va2 s  .c  o m*/
 * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2014, Gluu
 */

public class Main {
    /**
     * Assert that the statement is true, otherwise throw an exception with the provided message.
     * 
     * @param condition the condition to assert is true.
     * @param message the message to display if the condition is not true.
     */
    public static void assertTrue(final boolean condition, final String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }
}

Related

  1. assertTrue(boolean evalResult, Object... messages)
  2. assertTrue(boolean express)
  3. assertTrue(boolean expression)
  4. assertTrue(boolean expValue, String errMsg)
  5. assertTrue(boolean value)
  6. assertTrue(final boolean result, final String faultDescription)
  7. assertTrue(final String message, final boolean condition)
  8. assertTrue(String message, boolean condition)
  9. assertTrue(String message, boolean condition)