public class SoftAssertions
extends java.lang.Object
NativeModuleCallExceptionHandler
. See the javadoc on that class for more
information about our opinion on when these assertions should be used as opposed to assertions
that might throw AssertionError Throwables that will cause the app to hard crash.Constructor and Description |
---|
SoftAssertions() |
Modifier and Type | Method and Description |
---|---|
static void |
assertCondition(boolean condition,
java.lang.String message)
Asserts the given condition, throwing an
AssertionException if the condition doesn't
hold. |
static <T> T |
assertNotNull(T instance)
Asserts that the given Object isn't null, throwing an
AssertionException if it was. |
static void |
assertUnreachable(java.lang.String message)
Throw
AssertionException with a given message. |
public static void assertUnreachable(java.lang.String message)
AssertionException
with a given message. Use this method surrounded with if
block with assert condition in case you plan to do string concatenation to produce the
message. This logs an assertion with ReactSoftException, which decides whether or not to
actually throw.public static void assertCondition(boolean condition, java.lang.String message)
AssertionException
if the condition doesn't
hold. This logs an assertion with ReactSoftException, which decides whether or not to actually
throw.public static <T> T assertNotNull(T instance)
AssertionException
if it was.
This logs an assertion with ReactSoftException, which decides whether or not to actually throw.