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
Map s 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
Map s 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
Map s 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, matchesSafely
describeMismatch, matches
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
public IsMapWithSize(Matcher<? super java.lang.Integer> sizeMatcher)
protected java.lang.Integer featureValueOf(java.util.Map<? extends K,? extends V> actual)
FeatureMatcher
featureValueOf
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)
Map
s 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 Map
public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> aMapWithSize(int size)
Map
s 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 Map
public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> anEmptyMap()
Map
s that matches when the size()
method returns
zero.
For example:
assertThat(myMap, is(anEmptyMap()))