Class StringEndsWith

All Implemented Interfaces:
Matcher<String>, SelfDescribing

public class StringEndsWith extends SubstringMatcher
Tests if the argument is a string that ends with a specific substring.
  • Constructor Details

    • StringEndsWith

      public StringEndsWith(String substring)
    • StringEndsWith

      public StringEndsWith(boolean ignoringCase, String substring)
  • Method Details

    • evalSubstringOf

      protected boolean evalSubstringOf(String s)
      Specified by:
      evalSubstringOf 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
    • endsWithIgnoringCase

      public static Matcher<String> endsWithIgnoringCase(String suffix)
      Creates a matcher that matches if the examined String ends with the specified String, ignoring case. For example:
      assertThat("myStringOfNote", endsWithIgnoringCase("note"))
      Parameters:
      suffix - the substring that the returned matcher will expect at the end of any examined string