Class Assertions
- java.lang.Object
-
- com.heershingenmosiken.assertions.Assertions
-
public class Assertions extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Assertions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddAssertionHandler(AssertionHandler assertionHandler)Add AssertionHandler to handlers set, with DEFAULT_PRIORITY = 0static voidaddAssertionHandler(AssertionHandler assertionHandler, int priority)Add AssertionHandler to handler list, with provided priority.static voidassertEmpty(java.util.Collection shouldBeEmpty, ThrowableFactory throwableFactory)static voidassertFalse(boolean shouldBeFalse, ThrowableFactory throwableFactory)Checks that shouldBeFalse condition is false, else raises exception provided by ThrowableFactory.static voidassertNotEmpty(java.util.Collection shouldNotBeEmpty, ThrowableFactory throwableFactory)static voidassertNotNull(java.lang.Object shouldNotBeNull, ThrowableFactory throwableFactory)static voidassertNull(java.lang.Object shouldBeNull, ThrowableFactory throwableFactory)static voidassertTrue(boolean shouldBeTrue, ThrowableFactory throwableFactory)Checks that shouldBeTrue condition is true, else raises exception provided by ThrowableFactory.static voidfail(ThrowableFactory throwableFactory)Assertion failed with throwable factory.static voidfail(java.lang.Throwable throwable)Assertion failed with throwable.static voidfailSilently(java.lang.Throwable throwable)Assertion failed with throwable.protected static voidinternalRaiseAssertion(ThrowableFactory throwableFactory, java.lang.String message, boolean silent)static voidlog(java.lang.String message)static voidremoveAssertionHandler(AssertionHandler assertionHandler)Remove AssertionHandler from handlers list.
-
-
-
Method Detail
-
addAssertionHandler
public static void addAssertionHandler(AssertionHandler assertionHandler)
Add AssertionHandler to handlers set, with DEFAULT_PRIORITY = 0
-
addAssertionHandler
public static void addAssertionHandler(AssertionHandler assertionHandler, int priority)
Add AssertionHandler to handler list, with provided priority. Handlers with greater priority will be invoked earlier.
-
removeAssertionHandler
public static void removeAssertionHandler(AssertionHandler assertionHandler)
Remove AssertionHandler from handlers list.
-
internalRaiseAssertion
protected static void internalRaiseAssertion(ThrowableFactory throwableFactory, java.lang.String message, boolean silent)
-
log
public static void log(java.lang.String message)
-
fail
public static void fail(java.lang.Throwable throwable)
Assertion failed with throwable.
-
failSilently
public static void failSilently(java.lang.Throwable throwable)
Assertion failed with throwable. This assertion marked as silent.
-
fail
public static void fail(ThrowableFactory throwableFactory)
Assertion failed with throwable factory.
-
assertTrue
public static void assertTrue(boolean shouldBeTrue, ThrowableFactory throwableFactory)Checks that shouldBeTrue condition is true, else raises exception provided by ThrowableFactory.
-
assertFalse
public static void assertFalse(boolean shouldBeFalse, ThrowableFactory throwableFactory)Checks that shouldBeFalse condition is false, else raises exception provided by ThrowableFactory.
-
assertNull
public static void assertNull(java.lang.Object shouldBeNull, ThrowableFactory throwableFactory)
-
assertNotNull
public static void assertNotNull(java.lang.Object shouldNotBeNull, ThrowableFactory throwableFactory)
-
assertEmpty
public static void assertEmpty(java.util.Collection shouldBeEmpty, ThrowableFactory throwableFactory)
-
assertNotEmpty
public static void assertNotEmpty(java.util.Collection shouldNotBeEmpty, ThrowableFactory throwableFactory)
-
-