Class StringEndsWith

  • All Implemented Interfaces:
    Matcher<java.lang.String>, SelfDescribing

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

      • StringEndsWith

        public StringEndsWith​(java.lang.String substring)
      • StringEndsWith

        public StringEndsWith​(boolean ignoringCase,
                              java.lang.String substring)
    • Method Detail

      • endsWith

        public static Matcher<java.lang.String> endsWith​(java.lang.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
        Returns:
        The matcher.
      • endsWithIgnoringCase

        public static Matcher<java.lang.String> endsWithIgnoringCase​(java.lang.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
        Returns:
        The matcher.