Top Description Fields Constructors Methods
org.hamcrest.core

public Class StringStartsWith

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
protected boolean
protected String
public static Matcher<String>
startsWith(String
the substring that the returned matcher will expect at the start of any examined string
prefix
)

Creates a matcher that matches if the examined String starts with the specified String.

Inherited from org.hamcrest.core.SubstringMatcher:
describeMismatchSafelydescribeTomatchesSafely

Constructor Detail

StringStartsWithback to summary
public StringStartsWith(String substring)

Method Detail

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
startsWithback to summary
public static Matcher<String> startsWith(String prefix)

Creates a matcher that matches if the examined String starts with the specified String.

For example:

assertThat("myStringOfNote", startsWith("my"))
Parameters
prefix:String

the substring that the returned matcher will expect at the start of any examined string

Annotations
@Factory