org.hamcrest.text
Class StringContainsInOrder
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<java.lang.String>
org.hamcrest.text.StringContainsInOrder
- All Implemented Interfaces:
- org.hamcrest.Matcher<java.lang.String>, org.hamcrest.SelfDescribing
public class StringContainsInOrder
- extends org.hamcrest.TypeSafeMatcher<java.lang.String>
Method Summary |
void |
describeMismatchSafely(java.lang.String item,
org.hamcrest.Description mismatchDescription)
|
void |
describeTo(org.hamcrest.Description description)
|
boolean |
matchesSafely(java.lang.String s)
|
static org.hamcrest.Matcher<java.lang.String> |
stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
Creates a matcher of String that matches when the examined string contains all of
the specified substrings, regardless of the order of their appearance. |
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 |
StringContainsInOrder
public StringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
matchesSafely
public boolean matchesSafely(java.lang.String s)
- 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)
stringContainsInOrder
public static org.hamcrest.Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings)
- Creates a matcher of
String
that matches when the examined string contains all of
the specified substrings, regardless of the order of their appearance.
For example:
assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
- Parameters:
substrings
- the substrings that must be contained within matching strings