Package org.hamcrest.core
Class StringEndsWith
- java.lang.Object
- org.hamcrest.BaseMatcher<T>
- org.hamcrest.TypeSafeMatcher<String>
- org.hamcrest.core.SubstringMatcher
- org.hamcrest.core.StringEndsWith
- All Implemented Interfaces:
Matcher<String>,SelfDescribing
public class StringEndsWith extends SubstringMatcher
Tests if the argument is a string that contains a substring.
Field Summary
Fields inherited from class org.hamcrest.core.SubstringMatcher
substring
Constructor Summary
Constructors Constructor Description StringEndsWith(String substring)
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Matcher<String>endsWith(String suffix)protected booleanevalSubstringOf(String s)protected Stringrelationship()Methods inherited from class org.hamcrest.core.SubstringMatcher
describeMismatchSafely, describeTo, matchesSafely
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
Constructor Detail
StringEndsWith
public StringEndsWith(String substring)
Method Detail
evalSubstringOf
protected boolean evalSubstringOf(String s)
- Specified by:
evalSubstringOfin classSubstringMatcher
relationship
protected String relationship()
- Specified by:
relationshipin classSubstringMatcher
endsWith
public static Matcher<String> endsWith(String suffix)
Creates a matcher that matches if the examinedStringends with the specifiedString. For example:assertThat("myStringOfNote", endsWith("Note"))- Parameters:
suffix- the substring that the returned matcher will expect at the end of any examined string