fail to throw Assertion Error - Java java.lang

Java examples for java.lang:Assert

Description

fail to throw Assertion Error

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        Object message = "java2s.com";
        fail(message);/* w w w. j  a v a 2s . c  o m*/
    }

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

        throw new AssertionError(message);
    }
}

Related Tutorials