org.hamcrest.core
Class StringEndsWith

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<String>
          extended by org.hamcrest.core.SubstringMatcher
              extended by 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
StringEndsWith(String substring)
           
 
Method Summary
static Matcher<String> endsWith(String suffix)
          Creates a matcher that matches if the examined String ends with the specified String.
protected  boolean evalSubstringOf(String s)
           
protected  String relationship()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringEndsWith

public StringEndsWith(String substring)
Method Detail

evalSubstringOf

protected boolean evalSubstringOf(String s)
Specified by:
evalSubstringOf in class SubstringMatcher

relationship

protected String relationship()
Specified by:
relationship in class SubstringMatcher

endsWith

public static Matcher<String> endsWith(String suffix)
Creates a matcher that matches if the examined String ends with the specified String.

For example:

assertThat("myStringOfNote", endsWith("Note"))

Parameters:
suffix - the substring that the returned matcher will expect at the end of any examined string


Copyright © 2002–2014 JUnit. All rights reserved.