Class BasicErrorMessageFactory

java.lang.Object
org.assertj.core.error.BasicErrorMessageFactory
All Implemented Interfaces:
ErrorMessageFactory
Direct Known Subclasses:
AbstractShouldHaveTextContent, ActualIsNotEmpty, AnyElementShouldMatch, ClassModifierShouldBe, ConditionAndGroupGenericParameterTypeShouldBeTheSame, ElementsShouldBe, ElementsShouldBeAtLeast, ElementsShouldBeAtMost, ElementsShouldBeExactly, ElementsShouldHave, ElementsShouldHaveAtLeast, ElementsShouldHaveAtMost, ElementsShouldHaveExactly, ElementsShouldMatch, ElementsShouldNotBe, ElementsShouldNotHave, ElementsShouldSatisfy, MatcherShouldMatch, NoElementsShouldMatch, NoElementsShouldSatisfy, OptionalDoubleShouldHaveValueCloseToOffset, OptionalDoubleShouldHaveValueCloseToPercentage, OptionalShouldBeEmpty, OptionalShouldBePresent, OptionalShouldContain, OptionalShouldContainInstanceOf, ShouldAccept, ShouldBe, ShouldBeAbsolutePath, ShouldBeAbstract, ShouldBeAfter, ShouldBeAfterOrEqualTo, ShouldBeAfterYear, ShouldBeAlphabetic, ShouldBeAlphanumeric, ShouldBeAnArray, ShouldBeAnnotation, ShouldBeASCII, ShouldBeAssignableFrom, ShouldBeAssignableTo, ShouldBeAtIndex, ShouldBeAtSameInstant, ShouldBeBase64, ShouldBeBefore, ShouldBeBeforeOrEqualTo, ShouldBeBeforeYear, ShouldBeBetween, ShouldBeBlank, ShouldBeCancelled, ShouldBeCanonicalPath, ShouldBeCloseTo, ShouldBeCompleted, ShouldBeCompletedExceptionally, ShouldBeCompletedWithin, ShouldBeDirectory, ShouldBeDone, ShouldBeEmpty, ShouldBeEmptyDirectory, ShouldBeEqualByComparingFieldByFieldRecursively, ShouldBeEqualByComparingOnlyGivenFields, ShouldBeEqualIgnoringCase, ShouldBeEqualIgnoringHours, ShouldBeEqualIgnoringMinutes, ShouldBeEqualIgnoringNanos, ShouldBeEqualIgnoringNewLineDifferences, ShouldBeEqualIgnoringNewLines, ShouldBeEqualIgnoringSeconds, ShouldBeEqualIgnoringTimezone, ShouldBeEqualIgnoringWhitespace, ShouldBeEqualNormalizingPunctuationAndWhitespace, ShouldBeEqualNormalizingUnicode, ShouldBeEqualNormalizingWhitespace, ShouldBeEqualToIgnoringFields, ShouldBeEqualToWithSortedQueryParameters, ShouldBeEqualWithinOffset, ShouldBeEqualWithinPercentage, ShouldBeEqualWithTimePrecision, ShouldBeEven, ShouldBeExactlyInstanceOf, ShouldBeExecutable, ShouldBeExhausted, ShouldBeFalse, ShouldBeFile, ShouldBeFinite, ShouldBeGreater, ShouldBeGreaterOrEqual, ShouldBeHexadecimal, ShouldBeIn, ShouldBeInfinite, ShouldBeInSameDay, ShouldBeInSameHour, ShouldBeInSameHourWindow, ShouldBeInSameMinute, ShouldBeInSameMinuteWindow, ShouldBeInSameMonth, ShouldBeInSameSecond, ShouldBeInSameSecondWindow, ShouldBeInSameYear, ShouldBeInstance, ShouldBeInstanceOfAny, ShouldBeInterface, ShouldBeInTheFuture, ShouldBeInThePast, ShouldBeLess, ShouldBeLessOrEqual, ShouldBeLowerCase, ShouldBeMarked, ShouldBeMixedCase, ShouldBeNormalized, ShouldBeNullOrEmpty, ShouldBeNumeric, ShouldBeOdd, ShouldBeOfClassIn, ShouldBePeriod, ShouldBePrimitive, ShouldBePrintable, ShouldBeReadable, ShouldBeRecord, ShouldBeRegularFile, ShouldBeRelativePath, ShouldBeSame, ShouldBeSealed, ShouldBeSorted, ShouldBeSubsetOf, ShouldBeSubstring, ShouldBeSymbolicLink, ShouldBeToday, ShouldBeTrue, ShouldBeUnmodifiable, ShouldBeUpperCase, ShouldBeVisible, ShouldBeWritable, ShouldContain, ShouldContainAnyOf, ShouldContainAtIndex, ShouldContainCharSequence, ShouldContainCharSequenceOnlyOnce, ShouldContainEntries, ShouldContainEntry, ShouldContainExactly, ShouldContainExactlyInAnyOrder, ShouldContainKey, ShouldContainKeys, ShouldContainNull, ShouldContainOneOrMoreWhitespaces, ShouldContainOnly, ShouldContainOnlyDigits, ShouldContainOnlyKeys, ShouldContainOnlyNulls, ShouldContainOnlyWhitespaces, ShouldContainPattern, ShouldContainRecursively, ShouldContainSequence, ShouldContainSequenceOfCharSequence, ShouldContainsOnlyOnce, ShouldContainSubsequence, ShouldContainSubsequenceOfCharSequence, ShouldContainValue, ShouldContainValues, ShouldEndWith, ShouldEndWithIgnoringCase, ShouldEndWithPath, ShouldExist, ShouldHave, ShouldHaveAllNullFields, ShouldHaveAnchor, ShouldHaveAnnotations, ShouldHaveAtIndex, ShouldHaveAtLeastOneElementOfType, ShouldHaveAuthority, ShouldHaveBinaryContent, ShouldHaveCause, ShouldHaveCauseExactlyInstance, ShouldHaveCauseInstance, ShouldHaveCauseReference, ShouldHaveDateField, ShouldHaveDigest, ShouldHaveDimensions, ShouldHaveDuration, ShouldHaveExactlyTypes, ShouldHaveExtension, ShouldHaveFailed, ShouldHaveFailedWithin, ShouldHaveFields, ShouldHaveFileSystem, ShouldHaveFragment, ShouldHaveHost, ShouldHaveLineCount, ShouldHaveMessage, ShouldHaveMessageFindingMatchRegex, ShouldHaveMessageMatchingRegex, ShouldHaveMethods, ShouldHaveName, ShouldHaveNext, ShouldHaveNoCause, ShouldHaveNoExtension, ShouldHaveNoFields, ShouldHaveNoHost, ShouldHaveNoNullFields, ShouldHaveNoPackage, ShouldHaveNoParent, ShouldHaveNoSuperclass, ShouldHaveNoSuppressedExceptions, ShouldHaveOnlyElementsOfType, ShouldHavePackage, ShouldHaveParameter, ShouldHaveParent, ShouldHavePath, ShouldHavePeriod, ShouldHavePort, ShouldHavePropertyOrField, ShouldHavePropertyOrFieldWithValue, ShouldHaveProtocol, ShouldHaveQuery, ShouldHaveRecordComponents, ShouldHaveReference, ShouldHaveRootCause, ShouldHaveRootCauseExactlyInstance, ShouldHaveRootCauseInstance, ShouldHaveSameClass, ShouldHaveSameDimensionsAs, ShouldHaveSameFileSystemAs, ShouldHaveSameHashCode, ShouldHaveSameHourAs, ShouldHaveSameSizeAs, ShouldHaveSameTime, ShouldHaveScale, ShouldHaveScheme, ShouldHaveSize, ShouldHaveSizeBetween, ShouldHaveSizeGreaterThan, ShouldHaveSizeGreaterThanOrEqualTo, ShouldHaveSizeLessThan, ShouldHaveSizeLessThanOrEqualTo, ShouldHaveStamp, ShouldHaveSuperclass, ShouldHaveSuppressedException, ShouldHaveTime, ShouldHaveToString, ShouldHaveUserInfo, ShouldHaveValue, ShouldMatch, ShouldMatchPattern, ShouldNotAccept, ShouldNotBe, ShouldNotBeBetween, ShouldNotBeBlank, ShouldNotBeCancelled, ShouldNotBeCompleted, ShouldNotBeCompletedExceptionally, ShouldNotBeDone, ShouldNotBeEmpty, ShouldNotBeEqual, ShouldNotBeEqualComparingFieldByFieldRecursively, ShouldNotBeEqualIgnoringCase, ShouldNotBeEqualIgnoringWhitespace, ShouldNotBeEqualNormalizingWhitespace, ShouldNotBeEqualWithinOffset, ShouldNotBeEqualWithinPercentage, ShouldNotBeExactlyInstanceOf, ShouldNotBeFinite, ShouldNotBeIn, ShouldNotBeInfinite, ShouldNotBeInstance, ShouldNotBeInstanceOfAny, ShouldNotBeNull, ShouldNotBeOfClassIn, ShouldNotBePrimitive, ShouldNotBeSame, ShouldNotContain, ShouldNotContainAnyWhitespaces, ShouldNotContainAtIndex, ShouldNotContainCharSequence, ShouldNotContainKey, ShouldNotContainKeys, ShouldNotContainNull, ShouldNotContainOnlyWhitespaces, ShouldNotContainPattern, ShouldNotContainSequence, ShouldNotContainSubsequence, ShouldNotContainValue, ShouldNotEndWith, ShouldNotEndWithIgnoringCase, ShouldNotExist, ShouldNotHave, ShouldNotHaveAnyElementsOfTypes, ShouldNotHaveDuplicates, ShouldNotHaveFailed, ShouldNotHaveSameClass, ShouldNotHaveSameHashCode, ShouldNotHaveThrown, ShouldNotHaveToString, ShouldNotMatch, ShouldNotMatchPattern, ShouldNotSatisfyPredicateRecursively, ShouldNotStartWith, ShouldNotStartWithIgnoringCase, ShouldOnlyHaveElementsOfTypes, ShouldOnlyHaveFields, ShouldSatisfy, ShouldSatisfyOnlyOnce, ShouldStartWith, ShouldStartWithIgnoringCase, ShouldStartWithPath, SubarraysShouldHaveSameSize, ZippedElementsShouldSatisfy

public class BasicErrorMessageFactory extends Object implements ErrorMessageFactory
A factory of error messages typically shown when an assertion fails.
Author:
Alex Ruiz
  • Field Details

    • format

      protected final String format
    • arguments

      protected final Object[] arguments
  • Constructor Details

    • BasicErrorMessageFactory

      public BasicErrorMessageFactory(String format, Object... arguments)
      Parameters:
      format - the format string.
      arguments - arguments referenced by the format specifiers in the format string.
  • Method Details

    • create

      public String create(Description d, Representation representation)
      Creates a new error message as a result of a failed assertion.
      Specified by:
      create in interface ErrorMessageFactory
      Parameters:
      d - the description of the failed assertion.
      representation - the representation used
      Returns:
      the created error message.
    • create

      public String create(Description d)
      Creates a new error message as a result of a failed assertion with StandardRepresentation.
      Specified by:
      create in interface ErrorMessageFactory
      Parameters:
      d - the description of the failed assertion.
      Returns:
      the created error message.
    • create

      public String create()
      Creates a new error message as a result of a failed assertion without description.
      Specified by:
      create in interface ErrorMessageFactory
      Returns:
      the created error message.
    • unquotedString

      protected static CharSequence unquotedString(String string)
      Return a string who will be unquoted in message format (without '')
      Parameters:
      string - the string who will be unquoted.
      Returns:
      an unquoted string in message format.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object