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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the description of an assertion.voiddescription(String newDescription, Object... args) Sets the description of an assertion, if given null an emptyDescriptionis set.voiddescription(Description newDescription) Sets the description of an assertion, if given null an emptyDescriptionis set.Returns the text of this object's description, it is an empty String if no description was set.booleanReturns whether the text of this object's description was set.static StringmostRelevantDescriptionIn(WritableAssertionInfo info, String newDescription) Returns the message that, if specified, will replace the default message of an assertion failure.voidoverridingErrorMessage(String newErrorMessage) Sets the message that will replace the default message of an assertion failure.voidoverridingErrorMessage(Supplier<String> supplier) Sets the lazy fail message that will replace the default message of an assertion failure by using a supplier.toString()voidvoidvoiduseRepresentation(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:
overridingErrorMessagein 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:
descriptionin 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 emptyDescriptionis set.- Parameters:
newDescription- the new description.args- ifnewDescriptionis a format String,argsis argument ofString.format(String, Object...)- See Also:
-
description
Sets the description of an assertion, if given null an emptyDescriptionis set.To remove or clear the description, pass a
as argument.EmptyTextDescription- Parameters:
newDescription- the new description.
-
representation
- Specified by:
representationin interfaceAssertionInfo
-
useHexadecimalRepresentation
public void useHexadecimalRepresentation() -
useUnicodeRepresentation
public void useUnicodeRepresentation() -
useBinaryRepresentation
public void useBinaryRepresentation() -
useRepresentation
-
mostRelevantDescriptionIn
-
toString
-