org.hamcrest.text
Class StringContainsInOrder
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<String>
org.hamcrest.text.StringContainsInOrder
- All Implemented Interfaces:
- Matcher<String>, SelfDescribing
public class StringContainsInOrder
- extends TypeSafeMatcher<String>
StringContainsInOrder
public StringContainsInOrder(Iterable<String> substrings)
matchesSafely
public boolean matchesSafely(String s)
- Specified by:
matchesSafely in class TypeSafeMatcher<String>
describeMismatchSafely
public void describeMismatchSafely(String item,
Description mismatchDescription)
- Overrides:
describeMismatchSafely in class TypeSafeMatcher<String>
describeTo
public void describeTo(Description description)
stringContainsInOrder
public static Matcher<String> stringContainsInOrder(Iterable<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
stringContainsInOrder
public static Matcher<String> stringContainsInOrder(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("bar", "foo"))
- Parameters:
substrings - the substrings that must be contained within matching strings
Copyright © 2014. All rights reserved.