Top Description Fields Constructors Methods
org.hamcrest.core

public Class StringContains

extends SubstringMatcher
Class Inheritance
Imports
org.hamcrest.Matcher

Tests if the argument is a string that contains a specific substring.

Field Summary

Inherited from org.hamcrest.core.SubstringMatcher:
substring

Constructor Summary

AccessConstructor and Description
public
public
StringContains(boolean ignoringCase, String substring)

Method Summary

Modifier and TypeMethod and Description
public static Matcher<String>
containsString(String
the substring that the returned matcher will expect to find within any examined string
substring
)

Creates a matcher that matches if the examined String contains the specified String anywhere.

public static Matcher<String>
containsStringIgnoringCase(String
the substring that the returned matcher will expect to find within any examined string
substring
)

Creates a matcher that matches if the examined String contains the specified String anywhere, ignoring case.

protected boolean
Inherited from org.hamcrest.core.SubstringMatcher:
converteddescribeMismatchSafelydescribeTomatchesSafely

Constructor Detail

StringContainsback to summary
public StringContains(String substring)
StringContainsback to summary
public StringContains(boolean ignoringCase, String substring)

Method Detail

containsStringback to summary
public static Matcher<String> containsString(String substring)

Creates a matcher that matches if the examined String contains the specified String anywhere. For example:

assertThat("myStringOfNote", containsString("ring"))
Parameters
substring:String

the substring that the returned matcher will expect to find within any examined string

containsStringIgnoringCaseback to summary
public static Matcher<String> containsStringIgnoringCase(String substring)

Creates a matcher that matches if the examined String contains the specified String anywhere, ignoring case. For example:

assertThat("myStringOfNote", containsStringIgnoringCase("Ring"))
Parameters
substring:String

the substring that the returned matcher will expect to find within any examined string

evalSubstringOfback to summary
protected boolean evalSubstringOf(String s)

Implements abstract org.hamcrest.core.SubstringMatcher.evalSubstringOf.

Annotations
@Override