Package org.assertj.core.api
Class WritableAssertionInfo
java.lang.Object
org.assertj.core.api.WritableAssertionInfo
- All Implemented Interfaces:
AssertionInfo
Writable information about an assertion.
- Author:
- Alex Ruiz, Yvonne Wang
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the description of an assertion.void
description
(String newDescription, Object... args) Sets the description of an assertion, if given null an emptyDescription
is set.void
description
(Description newDescription) Sets the description of an assertion, if given null an emptyDescription
is set.Returns the text of this object's description, it is an empty String if no description was set.boolean
Returns whether the text of this object's description was set.static String
mostRelevantDescriptionIn
(WritableAssertionInfo info, String newDescription) Returns the message that, if specified, will replace the default message of an assertion failure.void
overridingErrorMessage
(String newErrorMessage) Sets the message that will replace the default message of an assertion failure.void
overridingErrorMessage
(Supplier<String> supplier) Sets the lazy fail message that will replace the default message of an assertion failure by using a supplier.toString()
void
void
void
useRepresentation
(Representation newRepresentation) void
-
Constructor Details
-
WritableAssertionInfo
-
WritableAssertionInfo
public WritableAssertionInfo()
-
-
Method Details
-
overridingErrorMessage
Returns the message that, if specified, will replace the default message of an assertion failure.- Specified by:
overridingErrorMessage
in interfaceAssertionInfo
- Returns:
- the message that, if specified, will replace the default message of an assertion failure.
-
overridingErrorMessage
Sets the message that will replace the default message of an assertion failure.- Parameters:
newErrorMessage
- the new message. It can benull
.- Throws:
IllegalStateException
- if the message has already been overridden withoverridingErrorMessage(Supplier)
.
-
overridingErrorMessage
Sets the lazy fail message that will replace the default message of an assertion failure by using a supplier.- Parameters:
supplier
- the new message by a supplier. It can benull
.- Throws:
IllegalStateException
- if the message has already been overridden withoverridingErrorMessage(String)
.
-
description
Returns the description of an assertion.- Specified by:
description
in interfaceAssertionInfo
- Returns:
- the description of an assertion.
-
descriptionText
Returns the text of this object's description, it is an empty String if no description was set.- Returns:
- the text of this object's description.
-
hasDescription
public boolean hasDescription()Returns whether the text of this object's description was set.- Returns:
- whether the text of this object's description was set.
-
description
Sets the description of an assertion, if given null an emptyDescription
is set.- Parameters:
newDescription
- the new description.args
- ifnewDescription
is a format String,args
is argument ofString.format(String, Object...)
- See Also:
-
description
Sets the description of an assertion, if given null an emptyDescription
is set.To remove or clear the description, pass a
as argument.EmptyTextDescription
- Parameters:
newDescription
- the new description.
-
representation
- Specified by:
representation
in interfaceAssertionInfo
-
useHexadecimalRepresentation
public void useHexadecimalRepresentation() -
useUnicodeRepresentation
public void useUnicodeRepresentation() -
useBinaryRepresentation
public void useBinaryRepresentation() -
useRepresentation
-
mostRelevantDescriptionIn
-
toString
-