Java examples for java.lang:Assert
assert Not Null
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { Object object = "java2s.com"; assertNotNull(object);/*from ww w . j av a 2 s . c o m*/ } public static void assertNotNull(final String message, final Object object) { assertTrue(message, object != null); } public static void assertNotNull(final Object object) { assertNotNull(null, object); } 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); } }