Top Description Fields Constructors Methods
org.hamcrest.core

public Class StringStartsWith

extends SubstringMatcher
Class Inheritance
Imports
org.hamcrest.Matcher

Tests if the argument is a string that starts with a specific substring.

Field Summary

Inherited from org.hamcrest.core.SubstringMatcher:
substring

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
protected boolean
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.

public static Matcher<String>
startsWithIgnoringCase(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, ignoring case For example:

assertThat("myStringOfNote", startsWithIgnoringCase("My"))
Inherited from org.hamcrest.core.SubstringMatcher:
converteddescribeMismatchSafelydescribeTomatchesSafely

Constructor Detail

StringStartsWithback to summary
public StringStartsWith(String substring)
StringStartsWithback to summary
public StringStartsWith(boolean ignoringCase, String substring)

Method Detail

evalSubstringOfback to summary
protected boolean evalSubstringOf(String s)

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

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

startsWithIgnoringCaseback to summary
public static Matcher<String> startsWithIgnoringCase(String prefix)

Creates a matcher that matches if the examined String starts with the specified String, ignoring case

For example:
assertThat("myStringOfNote", startsWithIgnoringCase("My"))
Parameters
prefix:String

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