Package org.hamcrest
Class StringDescription
java.lang.Object
org.hamcrest.BaseDescription
org.hamcrest.StringDescription
- All Implemented Interfaces:
Description
A
Description that is stored as a string.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hamcrest.Description
Description.NullDescription -
Field Summary
Fields inherited from interface org.hamcrest.Description
NONE -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new description.Creates a new description using the given appendable. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappend(char c) Append the char c to the description.protected voidAppend the String str to the description.static StringasString(SelfDescribing selfDescribing) Alias fortoString(SelfDescribing).toString()Returns the description as a string.static StringtoString(SelfDescribing selfDescribing) Return the description of aSelfDescribingobject as a String.Methods inherited from class org.hamcrest.BaseDescription
appendDescriptionOf, appendList, appendText, appendValue, appendValueList, appendValueList
-
Constructor Details
-
StringDescription
public StringDescription()Creates a new description. -
StringDescription
Creates a new description using the given appendable.- Parameters:
out- the place to append the description.
-
-
Method Details
-
toString
Return the description of aSelfDescribingobject as a String.- Parameters:
selfDescribing- The object to be described.- Returns:
- The description of the object.
-
asString
Alias fortoString(SelfDescribing).- Parameters:
selfDescribing- The object to be described.- Returns:
- The description of the object.
-
append
Description copied from class:BaseDescriptionAppend the String str to the description. The default implementation passes every character toBaseDescription.append(char). Override in subclasses to provide an efficient implementation.- Overrides:
appendin classBaseDescription- Parameters:
str- the string to append.
-
append
protected void append(char c) Description copied from class:BaseDescriptionAppend the char c to the description.- Specified by:
appendin classBaseDescription- Parameters:
c- the char to append.
-
toString
Returns the description as a string.
-