com.emarsys.ecommon.util
Class Assertions
java.lang.Object
com.emarsys.ecommon.util.Assertions
public class Assertions
- extends java.lang.Object
Provides assertions which cannot be disabled and do
automated logging.
Assertions
are used to beware of "this is not possible"
conditions, so the throwing of AssertionError
s is done
"manually" not using java's assert statement, because they can be
turned off and so are not useful at runtime.
It's better to handle AssertionError
s and/or crash early
than to leave a program in a "not possible" state which may cause
unredoable harm.
- Author:
- Michael "kULO" Kulovits
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Assertions
public Assertions()
assertTrue
public static void assertTrue(boolean cond,
java.lang.String msg)
throws java.lang.AssertionError
- Parameters:
cond
- msg
-
- Throws:
java.lang.AssertionError
assertFalse
public static void assertFalse(boolean cond,
java.lang.String msg)
throws java.lang.AssertionError
- Parameters:
cond
- msg
-
- Throws:
java.lang.AssertionError
assertTrue
public static void assertTrue(boolean cond)
throws java.lang.AssertionError
- Parameters:
cond
-
- Throws:
java.lang.AssertionError
assertFalse
public static void assertFalse(boolean cond)
throws java.lang.AssertionError
- Parameters:
cond
-
- Throws:
java.lang.AssertionError
assertNotNull
public static void assertNotNull(java.lang.Object o)
throws java.lang.AssertionError
- Parameters:
o
-
- Throws:
java.lang.AssertionError
assertNotEmpty
public static void assertNotEmpty(java.lang.Object o)
throws java.lang.AssertionError
- Parameters:
o
-
- Throws:
java.lang.AssertionError
assertIsInstanceOf
public static void assertIsInstanceOf(java.lang.Object o,
java.lang.Class<?> clazz)
- Parameters:
o
- clazz
-
fail
public static void fail()
throws java.lang.AssertionError
- Throws:
java.lang.AssertionError
fail
public static void fail(java.lang.String msg)
throws java.lang.AssertionError
- Parameters:
msg
-
- Throws:
java.lang.AssertionError
Copyright © 2010 emarsys AG. All Rights Reserved.