assert False - Java java.lang

Java examples for java.lang:Assert

Description

assert False

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        boolean condition = true;
        assertFalse(condition);// ww w  .ja va2  s  . co m
    }

    public static void assertFalse(final String message,
            final boolean condition) {
        assertTrue(message, !condition);
    }

    public static void assertFalse(final boolean condition) {
        assertFalse(null, condition);
    }

    public static void assertTrue(final String message,
            final boolean condition) {
        if (!condition) {
            fail(message);
        }
    }

    public static void assertTrue(final boolean condition) {
        assertTrue(null, condition);
    }

    public static void fail(final Object message) {
        if (message == null) {
            throw new AssertionError();
        }

        throw new AssertionError(message);
    }
}

Related Tutorials