Top Description Fields Constructors Methods
org.assertj.core.api

public Class WritableAssertionInfo

extends Object
implements AssertionInfo
Class Inheritance
All Implemented Interfaces
org.assertj.core.api.AssertionInfo
Static Imports
java.lang.String.format, java.util.Objects.requireNonNull, org.assertj.core.configuration.ConfigurationProvider.CONFIGURATION_PROVIDER, org.assertj.core.util.Preconditions.checkState, .Strings.isNullOrEmpty, .Strings.quote

Writable information about an assertion.
Authors
Alex Ruiz, Yvonne Wang

Field Summary

Modifier and TypeField and Description
private Description
private static final String
private String
private Supplier<String>
private Representation

Constructor Summary

AccessConstructor and Description
public
WritableAssertionInfo(Representation customRepresentation)

public

Method Summary

Modifier and TypeMethod and Description
public Description
description()

Implements org.assertj.core.api.AssertionInfo.description.

Returns the description of an assertion.
public void
description(String
the new description.
newDescription
,
Object...
if newDescription is a format String, args is argument of String#format(String, Object...)
args
)

Sets the description of an assertion, if given null an empty Description is set.

public void
description(Description
the new description.
newDescription
)

Sets the description of an assertion, if given null an empty Description is set.

public String

Returns:

the text of this object's description.
descriptionText
()

Returns the text of this object's description, it is an empty String if no description was set.

public boolean

Returns:

whether the text of this object's description was set.
hasDescription
()

Returns whether the text of this object's description was set.

public static String
public String
overridingErrorMessage()

Implements org.assertj.core.api.AssertionInfo.overridingErrorMessage.

Returns the message that, if specified, will replace the default message of an assertion failure.
public void
overridingErrorMessage(String
the new message. It can be null.
newErrorMessage
)

Sets the message that will replace the default message of an assertion failure.

public void
overridingErrorMessage(Supplier<String>
the new message by a supplier. It can be null.
supplier
)

Sets the lazy fail message that will replace the default message of an assertion failure by using a supplier.

public Representation
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
public void
public void
useRepresentation(Representation newRepresentation)

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

descriptionback to summary
private Description description
EMPTY_STRINGback to summary
private static final String EMPTY_STRING
overridingErrorMessageback to summary
private String overridingErrorMessage
overridingErrorMessageSupplierback to summary
private Supplier<String> overridingErrorMessageSupplier
representationback to summary
private Representation representation

Constructor Detail

WritableAssertionInfoback to summary
public WritableAssertionInfo(Representation customRepresentation)
WritableAssertionInfoback to summary
public WritableAssertionInfo()

Method Detail

descriptionback to summary
public Description description()

Implements org.assertj.core.api.AssertionInfo.description.

Doc from org.assertj.core.api.AssertionInfo.description.

Returns the description of an assertion.

Returns:Description

the description of an assertion.

Annotations
@Override
descriptionback to summary
public void description(String newDescription, Object... args)

Sets the description of an assertion, if given null an empty Description is set.

Parameters
newDescription:String

the new description.

args:Object[]

if newDescription is a format String, args is argument of String#format(String, Object...)

See Also
description(Description)
descriptionback to summary
public void description(Description newDescription)

Sets the description of an assertion, if given null an empty Description is set.

To remove or clear the description, pass a EmptyTextDescription as argument.

Parameters
newDescription:Description

the new description.

descriptionTextback to summary
public String descriptionText()

Returns the text of this object's description, it is an empty String if no description was set.

Returns:String

the text of this object's description.

hasDescriptionback to summary
public boolean hasDescription()

Returns whether the text of this object's description was set.

Returns:boolean

whether the text of this object's description was set.

mostRelevantDescriptionInback to summary
public static String mostRelevantDescriptionIn(WritableAssertionInfo info, String newDescription)
overridingErrorMessageback to summary
public String overridingErrorMessage()

Implements org.assertj.core.api.AssertionInfo.overridingErrorMessage.

Doc from org.assertj.core.api.AssertionInfo.overridingErrorMessage.

Returns the message that, if specified, will replace the default message of an assertion failure.

Returns:String

the message that, if specified, will replace the default message of an assertion failure.

Annotations
@Override
overridingErrorMessageback to summary
public void overridingErrorMessage(String newErrorMessage)

Sets the message that will replace the default message of an assertion failure.

Parameters
newErrorMessage:String

the new message. It can be null.

Exceptions
IllegalStateException:
if the message has already been overridden with overridingErrorMessage(Supplier).
overridingErrorMessageback to summary
public void overridingErrorMessage(Supplier<String> supplier)

Sets the lazy fail message that will replace the default message of an assertion failure by using a supplier.

Parameters
supplier:Supplier<String>

the new message by a supplier. It can be null.

Exceptions
IllegalStateException:
if the message has already been overridden with overridingErrorMessage(String).
representationback to summary
public Representation representation()

Implements org.assertj.core.api.AssertionInfo.representation.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
useBinaryRepresentationback to summary
public void useBinaryRepresentation()
useHexadecimalRepresentationback to summary
public void useHexadecimalRepresentation()
useRepresentationback to summary
public void useRepresentation(Representation newRepresentation)
useUnicodeRepresentationback to summary
public void useUnicodeRepresentation()