Top Fields Constructors Methods
org.hamcrest.text

public Class StringContainsInOrder

extends TypeSafeMatcher<String>
Class Inheritance
Imports
org.hamcrest.Description, .Matcher, .TypeSafeMatcher, java.util.Arrays

Field Summary

Modifier and TypeField and Description
private final Iterable<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
describeMismatchSafely(String item, Description mismatchDescription)

Overrides org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Subclasses should override this.
public void
describeTo(Description
The description to be built or appended to.
description
)

Implements org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object.
public boolean
matchesSafely(String s)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this.
public static Matcher<String>
stringContainsInOrder(Iterable<String>
the substrings that must be contained within matching strings
substrings
)

Creates a matcher of String that matches when the examined string contains all of the specified substrings, considering the order of their appearance.

public static Matcher<String>
stringContainsInOrder(String...
the substrings that must be contained within matching strings
substrings
)

Creates a matcher of String that matches when the examined string contains all of the specified substrings, considering the order of their appearance.

Inherited from org.hamcrest.TypeSafeMatcher:
describeMismatchmatches

Field Detail

substringsback to summary
private final Iterable<String> substrings

Constructor Detail

StringContainsInOrderback to summary
public StringContainsInOrder(Iterable<String> substrings)

Method Detail

describeMismatchSafelyback to summary
public void describeMismatchSafely(String item, Description mismatchDescription)

Overrides org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Doc from org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Subclasses should override this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override
describeToback to summary
public void describeTo(Description description)

Implements org.hamcrest.SelfDescribing.describeTo.

Doc from org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.

Parameters
description:Description

The description to be built or appended to.

Annotations
@Override
matchesSafelyback to summary
public boolean matchesSafely(String s)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Doc from org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override
stringContainsInOrderback to summary
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, considering the order of their appearance. For example:

assertThat("myfoobarbaz", stringContainsInOrder(Arrays.asList("bar", "foo")))
fails as "foo" occurs before "bar" in the string "myfoobarbaz"
Parameters
substrings:Iterable<String>

the substrings that must be contained within matching strings

stringContainsInOrderback to summary
public static Matcher<String> stringContainsInOrder(String... substrings)

Creates a matcher of String that matches when the examined string contains all of the specified substrings, considering the order of their appearance. For example:

assertThat("myfoobarbaz", stringContainsInOrder("bar", "foo"))
fails as "foo" occurs before "bar" in the string "myfoobarbaz"
Parameters
substrings:String[]

the substrings that must be contained within matching strings