Class StringUtil
java.lang.Object
com.google.common.truth.StringUtil
Utilities for string comparisons.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringSubstitutes each%sintemplatewith an argument.(package private) static StringmessageFor(String message, CharSequence expected, CharSequence actual) Returns a message appropriate for string comparisons.
-
Constructor Details
-
StringUtil
private StringUtil()
-
-
Method Details
-
messageFor
Returns a message appropriate for string comparisons. TODO(user): Do something closer to what JUnit'sComparisonFailuredoes. -
format
Substitutes each%sintemplatewith an argument. These are matched by position - the first%sgetsargs[0], etc. If there are more arguments than placeholders, the unmatched arguments will be appended to the end of the formatted message in square braces. Cribbed from Guava'sPreconditionsto allow for a GWT-compatible alternative toString.format(String, Object...)- Parameters:
template- a non-null string containing 0 or more%splaceholders.args- the arguments to be substituted into the message template. Arguments are converted to strings usingString.valueOf(Object). Arguments can be null.- See Also:
-