/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, regardless of the order of their appearance. * <p/> * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))</pre> * * @param substrings * the substrings that must be contained within matching strings */ public static org.hamcrest.Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }
/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))</pre> * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }
/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))</pre> * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ public static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }
/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))</pre> * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ public static org.hamcrest.Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }
/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))</pre> * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ public static org.hamcrest.Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }
public void testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() { assertMatches("substrings in order", matcher, "abcc"); assertMatches("substrings separated", matcher, "1a2b3c4c5"); assertDoesNotMatch("can detect repeated strings for matching", stringContainsInOrder("abc", "abc"), "---abc---"); assertDoesNotMatch("substrings in order missing a repeated pattern", matcher, "abc"); assertDoesNotMatch("substrings out of order", matcher, "cab"); assertDoesNotMatch("no substrings in string", matcher, "xyz"); assertDoesNotMatch("substring missing", matcher, "ac"); assertDoesNotMatch("empty string", matcher, ""); }
/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))</pre> * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ public static Matcher<java.lang.String> stringContainsInOrder(java.lang.String... substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }
/** * Creates a matcher of {@link String} that matches when the examined string contains all of * the specified substrings, considering the order of their appearance. * For example: * <pre>assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))</pre> * fails as "foo" occurs before "bar" in the string "myfoobarbaz" * * @param substrings * the substrings that must be contained within matching strings */ public static Matcher<java.lang.String> stringContainsInOrder(java.lang.Iterable<java.lang.String> substrings) { return org.hamcrest.text.StringContainsInOrder.stringContainsInOrder(substrings); }