Package org.assertj.core.error
Class BasicErrorMessageFactory
- java.lang.Object
-
- org.assertj.core.error.BasicErrorMessageFactory
-
- All Implemented Interfaces:
ErrorMessageFactory
- Direct Known Subclasses:
AbstractShouldHaveTextContent,AnyElementShouldMatch,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,ShouldBeBefore,ShouldBeBeforeOrEqualTo,ShouldBeBeforeYear,ShouldBeBetween,ShouldBeBlank,ShouldBeCancelled,ShouldBeCanonicalPath,ShouldBeCloseTo,ShouldBeCompleted,ShouldBeCompletedExceptionally,ShouldBeDirectory,ShouldBeDone,ShouldBeEmpty,ShouldBeEmptyDirectory,ShouldBeEqualByComparingFieldByFieldRecursively,ShouldBeEqualByComparingOnlyGivenFields,ShouldBeEqualIgnoringCase,ShouldBeEqualIgnoringHours,ShouldBeEqualIgnoringMinutes,ShouldBeEqualIgnoringNanos,ShouldBeEqualIgnoringNewLineDifferences,ShouldBeEqualIgnoringNewLines,ShouldBeEqualIgnoringSeconds,ShouldBeEqualIgnoringTimezone,ShouldBeEqualIgnoringWhitespace,ShouldBeEqualNormalizingWhitespace,ShouldBeEqualToIgnoringFields,ShouldBeEqualWithinOffset,ShouldBeEqualWithinPercentage,ShouldBeEqualWithTimePrecision,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,ShouldBeOfClassIn,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,ShouldContainSequence,ShouldContainSequenceOfCharSequence,ShouldContainsOnlyOnce,ShouldContainSubsequence,ShouldContainSubsequenceOfCharSequence,ShouldContainValue,ShouldContainValues,ShouldEndWith,ShouldEndWithPath,ShouldExist,ShouldHave,ShouldHaveAllNullFields,ShouldHaveAnchor,ShouldHaveAnnotations,ShouldHaveAtIndex,ShouldHaveAtLeastOneElementOfType,ShouldHaveAuthority,ShouldHaveBinaryContent,ShouldHaveCause,ShouldHaveCauseExactlyInstance,ShouldHaveCauseInstance,ShouldHaveCauseReference,ShouldHaveDateField,ShouldHaveDigest,ShouldHaveExtension,ShouldHaveFailed,ShouldHaveFields,ShouldHaveFragment,ShouldHaveHost,ShouldHaveLineCount,ShouldHaveMessage,ShouldHaveMessageFindingMatchRegex,ShouldHaveMessageMatchingRegex,ShouldHaveMethods,ShouldHaveName,ShouldHaveNext,ShouldHaveNoCause,ShouldHaveNoFields,ShouldHaveNoNullFields,ShouldHaveNoParent,ShouldHaveNoSuppressedExceptions,ShouldHaveOnlyElementsOfType,ShouldHaveParameter,ShouldHaveParent,ShouldHavePath,ShouldHavePort,ShouldHavePropertyOrField,ShouldHavePropertyOrFieldWithValue,ShouldHaveProtocol,ShouldHaveQuery,ShouldHaveReference,ShouldHaveRootCause,ShouldHaveRootCauseExactlyInstance,ShouldHaveRootCauseInstance,ShouldHaveSameClass,ShouldHaveSameHashCode,ShouldHaveSameHourAs,ShouldHaveSameSizeAs,ShouldHaveSameTime,ShouldHaveScheme,ShouldHaveSize,ShouldHaveSizeBetween,ShouldHaveSizeGreaterThan,ShouldHaveSizeGreaterThanOrEqualTo,ShouldHaveSizeLessThan,ShouldHaveSizeLessThanOrEqualTo,ShouldHaveStamp,ShouldHaveSuppressedException,ShouldHaveTime,ShouldHaveToString,ShouldHaveUserInfo,ShouldHaveValue,ShouldMatch,ShouldMatchPattern,ShouldNotAccept,ShouldNotBe,ShouldNotBeBetween,ShouldNotBeBlank,ShouldNotBeCancelled,ShouldNotBeCompleted,ShouldNotBeCompletedExceptionally,ShouldNotBeDone,ShouldNotBeEmpty,ShouldNotBeEqual,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,ZippedElementsShouldSatisfy
public class BasicErrorMessageFactory extends Object implements ErrorMessageFactory
A factory of error messages typically shown when an assertion fails.- Author:
- Alex Ruiz
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBasicErrorMessageFactory.UnquotedStringTo avoid quoted String in message format.
-
Constructor Summary
Constructors Constructor Description BasicErrorMessageFactory(String format, Object... arguments)Creates a new.BasicErrorMessageFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringcreate()Creates a new error message as a result of a failed assertion without description.Stringcreate(Description d)Creates a new error message as a result of a failed assertion withStandardRepresentation.Stringcreate(Description d, Representation representation)Creates a new error message as a result of a failed assertion.booleanequals(Object obj)inthashCode()StringtoString()protected static CharSequenceunquotedString(String string)Return a string who will be unquoted in message format (without '')
-
-
-
Field Detail
-
format
protected final String format
-
arguments
protected final Object[] arguments
-
formatter
MessageFormatter formatter
-
-
Constructor Detail
-
BasicErrorMessageFactory
public BasicErrorMessageFactory(String format, 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 String create(Description d, Representation representation)
Creates a new error message as a result of a failed assertion.- Specified by:
createin interfaceErrorMessageFactory- 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 withStandardRepresentation.- Specified by:
createin interfaceErrorMessageFactory- 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:
createin interfaceErrorMessageFactory- 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.
-
-