org.assertj.core.error
Class BasicErrorMessageFactory

java.lang.Object
  extended by org.assertj.core.error.BasicErrorMessageFactory
All Implemented Interfaces:
ErrorMessageFactory
Direct Known Subclasses:
AbstractShouldHaveTextContent, ConditionAndGroupGenericParameterTypeShouldBeTheSame, ElementsShouldBe, ElementsShouldBeAtLeast, ElementsShouldBeAtMost, ElementsShouldBeExactly, ElementsShouldHave, ElementsShouldHaveAtLeast, ElementsShouldHaveAtMost, ElementsShouldHaveExactly, ElementsShouldNotBe, ElementsShouldNotHave, ShouldBe, ShouldBeAbsolutePath, ShouldBeAfter, ShouldBeAfterOrEqualsTo, ShouldBeAfterYear, ShouldBeAnArray, ShouldBeAnnotation, ShouldBeAssignableFrom, ShouldBeAtIndex, ShouldBeBefore, ShouldBeBeforeOrEqualsTo, ShouldBeBeforeYear, ShouldBeBetween, ShouldBeCloseTo, ShouldBeDirectory, ShouldBeEmpty, ShouldBeEqualByComparingOnlyGivenFields, ShouldBeEqualIgnoringCase, ShouldBeEqualToIgnoringFields, ShouldBeEqualWithinOffset, ShouldBeEqualWithTimePrecision, ShouldBeExactlyInstanceOf, ShouldBeExecutable, ShouldBeFile, ShouldBeGreater, ShouldBeGreaterOrEqual, ShouldBeIn, ShouldBeInSameDay, ShouldBeInSameHour, ShouldBeInSameHourWindow, ShouldBeInSameMinute, ShouldBeInSameMinuteWindow, ShouldBeInSameMonth, ShouldBeInSameSecond, ShouldBeInSameSecondWindow, ShouldBeInSameYear, ShouldBeInstance, ShouldBeInstanceOfAny, ShouldBeInterface, ShouldBeInTheFuture, ShouldBeInThePast, ShouldBeLess, ShouldBeLessOrEqual, ShouldBeLowerCase, ShouldBeNullOrEmpty, ShouldBeOfClassIn, ShouldBeReadable, ShouldBeRelativePath, ShouldBeSame, ShouldBeSorted, ShouldBeSubsetOf, ShouldBeToday, ShouldBeUpperCase, ShouldBeWithin, ShouldBeWritable, ShouldContain, ShouldContainAtIndex, ShouldContainCharSequence, ShouldContainCharSequenceOnlyOnce, ShouldContainCharSequenceSequence, ShouldContainExactly, ShouldContainKeys, ShouldContainNull, ShouldContainOnly, ShouldContainOnlyKeys, ShouldContainSequence, ShouldContainsOnlyOnce, ShouldContainSubsequence, ShouldContainValue, ShouldEndWith, ShouldExist, ShouldHave, ShouldHaveAnnotations, ShouldHaveAtIndex, ShouldHaveAtLeastOneElementOfType, ShouldHaveBinaryContent, ShouldHaveCauseExactlyInstance, ShouldHaveCauseInstance, ShouldHaveExtension, ShouldHaveFields, ShouldHaveLineCount, ShouldHaveMessage, ShouldHaveName, ShouldHaveNoCause, ShouldHaveNoParent, ShouldHaveOnlyElementsOfType, ShouldHaveParent, ShouldHaveRootCauseExactlyInstance, ShouldHaveRootCauseInstance, ShouldHaveSameClass, ShouldHaveSameSizeAs, ShouldHaveSize, ShouldHaveTime, ShouldMatchPattern, ShouldNotBe, ShouldNotBeBetween, ShouldNotBeEmpty, ShouldNotBeEqual, ShouldNotBeExactlyInstanceOf, ShouldNotBeIn, ShouldNotBeInstance, ShouldNotBeInstanceOfAny, ShouldNotBeNull, ShouldNotBeOfClassIn, ShouldNotBeSame, ShouldNotContain, ShouldNotContainAtIndex, ShouldNotContainCharSequence, ShouldNotContainKey, ShouldNotContainNull, ShouldNotContainValue, ShouldNotExist, ShouldNotHave, ShouldNotHaveDuplicates, ShouldNotHaveSameClass, ShouldNotMatchPattern, ShouldStartWith

public class BasicErrorMessageFactory
extends Object
implements ErrorMessageFactory

A factory of error messages typically shown when an assertion fails.

Author:
Alex Ruiz

Field Summary
protected  Object[] arguments
           
protected  String format
           
 
Constructor Summary
BasicErrorMessageFactory(String format, Object... arguments)
          Creates a new BasicErrorMessageFactory.
 
Method Summary
 String create()
          Creates a new error message as a result of a failed assertion without description.
 String create(Description d, Representation representation)
          Creates a new error message as a result of a failed assertion.
 boolean equals(Object obj)
           
 int hashCode()
           
 String toString()
           
protected static CharSequence unquotedString(String string)
          Return a string who will be unquoted in message format (without '')
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

format

protected final String format

arguments

protected final Object[] arguments
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:
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. ToString.quote

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


Copyright © 2013–2015 AssertJ. All rights reserved.