org.hamcrest.text
Class IsEqualIgnoringWhiteSpace

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<java.lang.String>
          extended by org.hamcrest.text.IsEqualIgnoringWhiteSpace
All Implemented Interfaces:
org.hamcrest.Matcher<java.lang.String>, org.hamcrest.SelfDescribing

public class IsEqualIgnoringWhiteSpace
extends org.hamcrest.TypeSafeMatcher<java.lang.String>

Tests if a string is equal to another string, ignoring any changes in whitespace.


Constructor Summary
IsEqualIgnoringWhiteSpace(java.lang.String string)
           
 
Method Summary
 void describeMismatchSafely(java.lang.String item, org.hamcrest.Description mismatchDescription)
           
 void describeTo(org.hamcrest.Description description)
           
static org.hamcrest.Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
          Creates a matcher of String that matches when the examined string is equal to the specified expectedString, when whitespace differences are (mostly) ignored.
 boolean matchesSafely(java.lang.String item)
           
 java.lang.String stripSpace(java.lang.String toBeStripped)
           
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IsEqualIgnoringWhiteSpace

public IsEqualIgnoringWhiteSpace(java.lang.String string)
Method Detail

matchesSafely

public boolean matchesSafely(java.lang.String item)
Specified by:
matchesSafely in class org.hamcrest.TypeSafeMatcher<java.lang.String>

describeMismatchSafely

public void describeMismatchSafely(java.lang.String item,
                                   org.hamcrest.Description mismatchDescription)
Overrides:
describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<java.lang.String>

describeTo

public void describeTo(org.hamcrest.Description description)

stripSpace

public java.lang.String stripSpace(java.lang.String toBeStripped)

equalToIgnoringWhiteSpace

public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString)
Creates a matcher of String that matches when the examined string is equal to the specified expectedString, when whitespace differences are (mostly) ignored. To be exact, the following whitespace rules are applied:

For example:

assertThat("   my\tfoo  bar ", equalToIgnoringWhiteSpace(" my  foo bar"))

Parameters:
expectedString - the expected value of matched strings