public final class IsMapWithSize<K,V> extends FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>
| Constructor and Description |
|---|
IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher) |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
aMapWithSize(int size)
Creates a matcher for
Maps that matches when the size() method returns
a value equal to the specified size. |
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
Creates a matcher for
Maps that matches when the size() method returns
a value that satisfies the specified matcher. |
static <K,V> Matcher<java.util.Map<? extends K,? extends V>> |
anEmptyMap()
Creates a matcher for
Maps that matches when the size() method returns
zero. |
protected java.lang.Integer |
featureValueOf(java.util.Map<? extends K,? extends V> actual)
Implement this to extract the interesting feature.
|
describeTo, matchesSafelydescribeMismatch, matches_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toStringpublic IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
protected java.lang.Integer featureValueOf(java.util.Map<? extends K,? extends V> actual)
FeatureMatcherfeatureValueOf in class FeatureMatcher<java.util.Map<? extends K,? extends V>,java.lang.Integer>actual - the target objectpublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
Maps that matches when the size() method returns
a value that satisfies the specified matcher.
For example:
assertThat(myMap, is(aMapWithSize(equalTo(2))))
sizeMatcher - a matcher for the size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)
Maps that matches when the size() method returns
a value equal to the specified size.
For example:
assertThat(myMap, is(aMapWithSize(2)))
size - the expected size of an examined Mappublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()
Maps that matches when the size() method returns
zero.
For example:
assertThat(myMap, is(anEmptyMap()))