Class WritableAssertionInfo

  • All Implemented Interfaces:
    AssertionInfo

    public class WritableAssertionInfo
    extends java.lang.Object
    implements AssertionInfo
    Writable information about an assertion.
    • Field Detail

      • overridingErrorMessage

        private java.lang.String overridingErrorMessage
    • Constructor Detail

      • WritableAssertionInfo

        public WritableAssertionInfo​(Representation customRepresentation)
      • WritableAssertionInfo

        public WritableAssertionInfo()
    • Method Detail

      • overridingErrorMessage

        public java.lang.String overridingErrorMessage()
        Returns the message that, if specified, will replace the default message of an assertion failure.
        Specified by:
        overridingErrorMessage in interface AssertionInfo
        Returns:
        the message that, if specified, will replace the default message of an assertion failure.
      • overridingErrorMessage

        public void overridingErrorMessage​(java.lang.String newErrorMessage)
        Sets the message that will replace the default message of an assertion failure.
        Parameters:
        newErrorMessage - the new message. It can be null.
      • description

        public Description description()
        Returns the description of an assertion.
        Specified by:
        description in interface AssertionInfo
        Returns:
        the description of an assertion.
      • descriptionText

        public java.lang.String 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

        public void description​(java.lang.String newDescription,
                                java.lang.Object... args)
        Sets the description of an assertion, if given null an empty Description is set.
        Parameters:
        newDescription - the new description.
        args - if newDescription is a format String, args is argument of String.format(String, Object...)
        See Also:
        description(Description)
      • description

        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 - the new description.
      • useHexadecimalRepresentation

        public void useHexadecimalRepresentation()
      • useUnicodeRepresentation

        public void useUnicodeRepresentation()
      • useBinaryRepresentation

        public void useBinaryRepresentation()
      • useRepresentation

        public void useRepresentation​(Representation newRepresentation)
      • mostRelevantDescriptionIn

        public static java.lang.String mostRelevantDescriptionIn​(WritableAssertionInfo info,
                                                                 java.lang.String newDescription)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object