Top Description Fields Constructors Methods
org.hamcrest.core

public Class StringContains

extends SubstringMatcher
Class Inheritance
Imports
org.hamcrest.Factory, .Matcher

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

Field Summary

Inherited from org.hamcrest.core.SubstringMatcher:
substring

Constructor Summary

AccessConstructor and Description
public

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.

protected boolean
protected String
Inherited from org.hamcrest.core.SubstringMatcher:
describeMismatchSafelydescribeTomatchesSafely

Constructor Detail

StringContainsback to summary
public StringContains(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

Annotations
@Factory
evalSubstringOfback to summary
protected boolean evalSubstringOf(String s)

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

Annotations
@Override
relationshipback to summary
protected String relationship()

Implements abstract org.hamcrest.core.SubstringMatcher.relationship.

Annotations
@Override