Home | History | Annotate | Download | only in text

Lines Matching defs:string

10  * Tests if a string is equal to another string, ignoring any changes in whitespace.
12 public class IsEqualIgnoringWhiteSpace extends TypeSafeMatcher<String> {
14 // TODO: Replace String with CharSequence to allow for easy interoperability between
15 // String, StringBuffer, StringBuilder, CharBuffer, etc (joe).
17 private final String string;
19 public IsEqualIgnoringWhiteSpace(String string) {
20 if (string == null) {
23 this.string = string;
27 public boolean matchesSafely(String item) {
28 return stripSpace(string).equalsIgnoreCase(stripSpace(item));
32 public void describeMismatchSafely(String item, Description mismatchDescription) {
39 .appendValue(string)
43 public String stripSpace(String toBeStripped) {
62 * Creates a matcher of {@link String} that matches when the examined string is equal to
66 * <li>all leading and trailing whitespace of both the expectedString and the examined string are ignored</li>
67 * <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li>
75 public static Matcher<String> equalToIgnoringWhiteSpace(String expectedString) {