public class StringMatcher extends org.hamcrest.TypeSafeDiagnosingMatcher<String>
| Modifier and Type | Method and Description |
|---|---|
static StringMatcher |
containsAll(String... substrings)
Creates a matcher that matches if the examined string contains all of the
specified substrings (regardless of the order they appear in the string).
|
static StringMatcher |
containsAny(String... substrings)
Creates a matcher that matches if the examined string contains any of the
specified substrings.
|
static StringMatcher |
containsNone(String... substrings)
Creates a matcher that matches if the examined string contains none of the
specified substrings.
|
void |
describeTo(org.hamcrest.Description description)
Describes the "expected" pat of the test description.
|
StringMatcher |
ignoreCase()
Tells the matcher to compare strings irrespective of case.
|
public static StringMatcher containsAll(String... substrings)
For example:
assertThat("the quick brown fox", containsAll("fox", "the"))
substrings - the substrings to be testedpublic static StringMatcher containsAny(String... substrings)
For example:
assertThat("the quick brown fox", containsAny("fox", "dragon"))
substrings - the substrings to be testedpublic static StringMatcher containsNone(String... substrings)
For example:
assertThat("the quick brown fox", containsNone("cat", "mouse"))
substrings - the substrings to be testedpublic StringMatcher ignoreCase()
For example:
assertThat("the quick brown fox", containsAny("FOX").ignoreCase())
public void describeTo(org.hamcrest.Description description)
description - the Description to be appended toCopyright © 2021. All rights reserved.