Package org.hamcrest
Class StringDescription
- java.lang.Object
- org.hamcrest.BaseDescription
- org.hamcrest.StringDescription
- All Implemented Interfaces:
Description
public class StringDescription extends BaseDescription
ADescription
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
Constructors Constructor Description StringDescription()
StringDescription(Appendable out)
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
append(char c)
Append the char c to the description.protected void
append(String str)
Append the String str to the description.static String
asString(SelfDescribing selfDescribing)
Alias fortoString(SelfDescribing)
.String
toString()
Returns the description as a string.static String
toString(SelfDescribing selfDescribing)
Return the description of aSelfDescribing
object as a String.Methods inherited from class org.hamcrest.BaseDescription
appendDescriptionOf, appendList, appendText, appendValue, appendValueList, appendValueList
Constructor Detail
StringDescription
public StringDescription()
StringDescription
public StringDescription(Appendable out)
Method Detail
toString
public static String toString(SelfDescribing selfDescribing)
Return the description of aSelfDescribing
object as a String.- Parameters:
selfDescribing
- The object to be described.- Returns:
- The description of the object.
asString
public static String asString(SelfDescribing selfDescribing)
Alias fortoString(SelfDescribing)
.
append
protected void append(String str)
Description copied from class:BaseDescription
Append the String str to the description. The default implementation passes every character toBaseDescription.append(char)
. Override in subclasses to provide an efficient implementation.- Overrides:
append
in classBaseDescription
append
protected void append(char c)
Description copied from class:BaseDescription
Append the char c to the description.- Specified by:
append
in classBaseDescription