Package org.fest.assertions.api
Class Fail
- java.lang.Object
-
- org.fest.assertions.api.Fail
-
public final class Fail extends java.lang.Object
Common failures.- Author:
- Alex Ruiz, Yvonne Wang, Joel Costigliola
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Fail()
This constructor is protected to make it possible to subclass this class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
fail(java.lang.String failureMessage)
Fails with the given message.static void
fail(java.lang.String failureMessage, java.lang.Throwable realCause)
Throws anAssertionError
with the given message and with theThrowable
that caused the failure.static void
failBecauseExceptionWasNotThrown(java.lang.Class<? extends java.lang.Throwable> throwableClass)
Throws anAssertionError
with a message explaining that aThrowable
of given class was expected to be thrown but had not been.static void
setRemoveFestRelatedElementsFromStackTrace(boolean removeFestRelatedElementsFromStackTrace)
Sets wether we remove elements related to Fest from assertion error stack trace.
-
-
-
Method Detail
-
setRemoveFestRelatedElementsFromStackTrace
public static void setRemoveFestRelatedElementsFromStackTrace(boolean removeFestRelatedElementsFromStackTrace)
Sets wether we remove elements related to Fest from assertion error stack trace.- Parameters:
removeFestRelatedElementsFromStackTrace
- flag.
-
fail
public static void fail(java.lang.String failureMessage)
Fails with the given message.- Parameters:
failureMessage
- error message.- Throws:
java.lang.AssertionError
- with the given message.
-
fail
public static void fail(java.lang.String failureMessage, java.lang.Throwable realCause)
Throws anAssertionError
with the given message and with theThrowable
that caused the failure.- Parameters:
failureMessage
- the description of the failed assertion. It can benull
.realCause
- cause of the error.- Throws:
java.lang.AssertionError
- with the given message and with theThrowable
that caused the failure.
-
failBecauseExceptionWasNotThrown
public static void failBecauseExceptionWasNotThrown(java.lang.Class<? extends java.lang.Throwable> throwableClass)
Throws anAssertionError
with a message explaining that aThrowable
of given class was expected to be thrown but had not been.- Parameters:
throwableClass
- the Throwable class that was expected to be thrown.- Throws:
java.lang.AssertionError
- with a message explaining that aThrowable
of given class was expected to be thrown but had not been.
-
-