Package org.assertj.core.error
Class BasicErrorMessageFactory
- java.lang.Object
-
- org.assertj.core.error.BasicErrorMessageFactory
-
- All Implemented Interfaces:
ErrorMessageFactory
- Direct Known Subclasses:
AbstractShouldHaveTextContent
,AnyElementShouldMatch
,Array2dElementShouldBeDeepEqual
,ClassModifierShouldBe
,ConditionAndGroupGenericParameterTypeShouldBeTheSame
,ElementsShouldBe
,ElementsShouldBeAtLeast
,ElementsShouldBeAtMost
,ElementsShouldBeExactly
,ElementsShouldHave
,ElementsShouldHaveAtLeast
,ElementsShouldHaveAtMost
,ElementsShouldHaveExactly
,ElementsShouldMatch
,ElementsShouldNotBe
,ElementsShouldNotHave
,ElementsShouldSatisfy
,NoElementsShouldMatch
,NoElementsShouldSatisfy
,OptionalDoubleShouldHaveValueCloseToOffset
,OptionalDoubleShouldHaveValueCloseToPercentage
,OptionalShouldBeEmpty
,OptionalShouldBePresent
,OptionalShouldContain
,OptionalShouldContainInstanceOf
,ShouldAccept
,ShouldBe
,ShouldBeAbsolutePath
,ShouldBeAbstract
,ShouldBeAfter
,ShouldBeAfterOrEqualTo
,ShouldBeAfterYear
,ShouldBeAnArray
,ShouldBeAnnotation
,ShouldBeAssignableFrom
,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
,ShouldBeEqualNormalizingWhitespace
,ShouldBeEqualToIgnoringFields
,ShouldBeEqualToWithSortedQueryParameters
,ShouldBeEqualWithinOffset
,ShouldBeEqualWithinPercentage
,ShouldBeEqualWithTimePrecision
,ShouldBeEven
,ShouldBeExactlyInstanceOf
,ShouldBeExecutable
,ShouldBeExhausted
,ShouldBeFile
,ShouldBeGreater
,ShouldBeGreaterOrEqual
,ShouldBeIn
,ShouldBeInSameDay
,ShouldBeInSameHour
,ShouldBeInSameHourWindow
,ShouldBeInSameMinute
,ShouldBeInSameMinuteWindow
,ShouldBeInSameMonth
,ShouldBeInSameSecond
,ShouldBeInSameSecondWindow
,ShouldBeInSameYear
,ShouldBeInstance
,ShouldBeInstanceOfAny
,ShouldBeInterface
,ShouldBeInTheFuture
,ShouldBeInThePast
,ShouldBeLess
,ShouldBeLessOrEqual
,ShouldBeLowerCase
,ShouldBeMarked
,ShouldBeNormalized
,ShouldBeNullOrEmpty
,ShouldBeOdd
,ShouldBeOfClassIn
,ShouldBePeriod
,ShouldBeReadable
,ShouldBeRegularFile
,ShouldBeRelativePath
,ShouldBeSame
,ShouldBeSorted
,ShouldBeSubsetOf
,ShouldBeSubstring
,ShouldBeSymbolicLink
,ShouldBeToday
,ShouldBeUpperCase
,ShouldBeWritable
,ShouldContain
,ShouldContainAnyOf
,ShouldContainAtIndex
,ShouldContainCharSequence
,ShouldContainCharSequenceOnlyOnce
,ShouldContainEntry
,ShouldContainExactly
,ShouldContainExactlyInAnyOrder
,ShouldContainKey
,ShouldContainKeys
,ShouldContainNull
,ShouldContainOneOrMoreWhitespaces
,ShouldContainOnly
,ShouldContainOnlyDigits
,ShouldContainOnlyKeys
,ShouldContainOnlyNulls
,ShouldContainOnlyWhitespaces
,ShouldContainPattern
,ShouldContainRecursively
,ShouldContainSequence
,ShouldContainSequenceOfCharSequence
,ShouldContainsOnlyOnce
,ShouldContainSubsequence
,ShouldContainSubsequenceOfCharSequence
,ShouldContainValue
,ShouldContainValues
,ShouldEndWith
,ShouldEndWithPath
,ShouldExist
,ShouldHave
,ShouldHaveAllNullFields
,ShouldHaveAnchor
,ShouldHaveAnnotations
,ShouldHaveAtIndex
,ShouldHaveAtLeastOneElementOfType
,ShouldHaveAuthority
,ShouldHaveBinaryContent
,ShouldHaveCause
,ShouldHaveCauseExactlyInstance
,ShouldHaveCauseInstance
,ShouldHaveCauseReference
,ShouldHaveDateField
,ShouldHaveDigest
,ShouldHaveDimensions
,ShouldHaveDuration
,ShouldHaveExtension
,ShouldHaveFailed
,ShouldHaveFields
,ShouldHaveFragment
,ShouldHaveHost
,ShouldHaveLineCount
,ShouldHaveMessage
,ShouldHaveMessageFindingMatchRegex
,ShouldHaveMessageMatchingRegex
,ShouldHaveMethods
,ShouldHaveName
,ShouldHaveNext
,ShouldHaveNoCause
,ShouldHaveNoFields
,ShouldHaveNoNullFields
,ShouldHaveNoParent
,ShouldHaveNoSuperclass
,ShouldHaveNoSuppressedExceptions
,ShouldHaveOnlyElementsOfType
,ShouldHaveParameter
,ShouldHaveParent
,ShouldHavePath
,ShouldHavePeriod
,ShouldHavePort
,ShouldHavePropertyOrField
,ShouldHavePropertyOrFieldWithValue
,ShouldHaveProtocol
,ShouldHaveQuery
,ShouldHaveReference
,ShouldHaveRootCause
,ShouldHaveRootCauseExactlyInstance
,ShouldHaveRootCauseInstance
,ShouldHaveSameClass
,ShouldHaveSameDimensionsAs
,ShouldHaveSameHashCode
,ShouldHaveSameHourAs
,ShouldHaveSameSizeAs
,ShouldHaveSameTime
,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
,ShouldNotBeIn
,ShouldNotBeInstance
,ShouldNotBeInstanceOfAny
,ShouldNotBeNull
,ShouldNotBeOfClassIn
,ShouldNotBeSame
,ShouldNotContain
,ShouldNotContainAnyWhitespaces
,ShouldNotContainAtIndex
,ShouldNotContainCharSequence
,ShouldNotContainKey
,ShouldNotContainKeys
,ShouldNotContainNull
,ShouldNotContainOnlyWhitespaces
,ShouldNotContainPattern
,ShouldNotContainSequence
,ShouldNotContainSubsequence
,ShouldNotContainValue
,ShouldNotEndWith
,ShouldNotExist
,ShouldNotHave
,ShouldNotHaveAnyElementsOfTypes
,ShouldNotHaveDuplicates
,ShouldNotHaveFailed
,ShouldNotHaveSameClass
,ShouldNotHaveThrown
,ShouldNotMatch
,ShouldNotMatchPattern
,ShouldNotStartWith
,ShouldOnlyHaveElementsOfTypes
,ShouldOnlyHaveFields
,ShouldSatisfy
,ShouldStartWith
,ShouldStartWithPath
,SubarraysShouldHaveSameSize
,ZippedElementsShouldSatisfy
public class BasicErrorMessageFactory extends java.lang.Object implements ErrorMessageFactory
A factory of error messages typically shown when an assertion fails.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
BasicErrorMessageFactory.UnquotedString
To avoid quoted String in message format.
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Object[]
arguments
protected java.lang.String
format
(package private) MessageFormatter
formatter
-
Constructor Summary
Constructors Constructor Description BasicErrorMessageFactory(java.lang.String format, java.lang.Object... arguments)
Creates a new
.BasicErrorMessageFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
create()
Creates a new error message as a result of a failed assertion without description.java.lang.String
create(Description d)
Creates a new error message as a result of a failed assertion withStandardRepresentation
.java.lang.String
create(Description d, Representation representation)
Creates a new error message as a result of a failed assertion.boolean
equals(java.lang.Object obj)
int
hashCode()
java.lang.String
toString()
protected static java.lang.CharSequence
unquotedString(java.lang.String string)
Return a string who will be unquoted in message format (without '')
-
-
-
Field Detail
-
format
protected final java.lang.String format
-
arguments
protected final java.lang.Object[] arguments
-
formatter
MessageFormatter formatter
-
-
Constructor Detail
-
BasicErrorMessageFactory
public BasicErrorMessageFactory(java.lang.String format, java.lang.Object... arguments)
Creates a new
.BasicErrorMessageFactory
- Parameters:
format
- the format string.arguments
- arguments referenced by the format specifiers in the format string.
-
-
Method Detail
-
create
public java.lang.String create(Description d, Representation representation)
Creates a new error message as a result of a failed assertion.- Specified by:
create
in interfaceErrorMessageFactory
- Parameters:
d
- the description of the failed assertion.representation
- the representation used- Returns:
- the created error message.
-
create
public java.lang.String create(Description d)
Creates a new error message as a result of a failed assertion withStandardRepresentation
.- Specified by:
create
in interfaceErrorMessageFactory
- Parameters:
d
- the description of the failed assertion.- Returns:
- the created error message.
-
create
public java.lang.String create()
Creates a new error message as a result of a failed assertion without description.- Specified by:
create
in interfaceErrorMessageFactory
- Returns:
- the created error message.
-
unquotedString
protected static java.lang.CharSequence unquotedString(java.lang.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(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-