Class Assertion
- Direct Known Subclasses:
- FluentAssertion
Test Methods:
- None
Transform Methods:
- None
Configuration Methods:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected static <E> Class<E[]>arrayClass(Class<E> c) Convenience method for getting the array class of the specified element type.protected static StringConvenience method for getting the class name for an object.protected BasicAssertionErrorCreates a newBasicAssertionError.protected BasicAssertionErrorCreates a newBasicAssertionError.Allows you to override the assertion failure message.setOut(PrintStream value) If an error occurs, send the error message to the specified stream instead of STDERR.Suppresses output to STDERR.If an error occurs, send the error message to STDOUT instead of STDERR.setThrowable(Class<? extends RuntimeException> value) If an error occurs, throw this exception instead of the standardAssertionError.
- 
Constructor Details- 
AssertionConstructor used when this assertion is being created from within another assertion.- Parameters:
- creator- The creator of this assertion.
 
 
- 
- 
Method Details- 
setMsgAllows you to override the assertion failure message.String can contain "{msg}" to represent the original message.Example:import static org.apache.juneau.assertions.Assertions.*;// Throws an assertion with a custom message instead of the default "Value was null." assertString (myString ) .setMsg("My string was bad: {msg}" ) .isNotNull();- Parameters:
- msg- The assertion failure message.
- args- Optional message arguments.
- Returns:
- This object.
 
- 
setStdOutIf an error occurs, send the error message to STDOUT instead of STDERR.- Returns:
- This object.
 
- 
setOutIf an error occurs, send the error message to the specified stream instead of STDERR.- Parameters:
- value- The output stream. Can be- null to suppress output.
- Returns:
- This object.
 
- 
setSilentSuppresses output to STDERR.This is the equivalent to calling out( .null )- Returns:
- This object.
 
- 
setThrowableIf an error occurs, throw this exception instead of the standardAssertionError.The throwable class must have a public constructor that takes in any of the following parameters: If the throwable cannot be instantiated, a RuntimeExceptionis thrown instead.Example:import static org.apache.juneau.assertions.Assertions.*;// Throws a BadRequest instead of an AssertionError if the string is null. assertString (myString ) .setThrowable(BadRequest.class ) .isNotNull();- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
errorCreates a newBasicAssertionError.- Parameters:
- msg- The message.
- args- The message arguments.
- Returns:
- A new BasicAssertionError.
 
- 
errorCreates a newBasicAssertionError.- Parameters:
- cause- Optional caused-by throwable.
- msg- The message.
- args- The message arguments.
- Returns:
- A new BasicAssertionError.
 
- 
classNameConvenience method for getting the class name for an object.- Parameters:
- o- The object to get the class name for.
- Returns:
- The class name for an object.
 
- 
arrayClassConvenience method for getting the array class of the specified element type.- Type Parameters:
- E- The element type.
- Parameters:
- c- The object to get the class name for.
- Returns:
- The class name for an object.
 
 
-