Class StringContains

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

    public class StringContains
    extends SubstringMatcher
    Tests if the argument is a string that contains a substring.
    • Constructor Detail

      • StringContains

        public StringContains​(java.lang.String substring)
    • Method Detail

      • containsString

        public static Matcher<java.lang.String> containsString​(java.lang.String substring)
        Creates a matcher that matches if the examined String contains the specified String anywhere.

        For example:

        assertThat("myStringOfNote", containsString("ring"))
        Parameters:
        substring - the substring that the returned matcher will expect to find within any examined string