|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hamcrest.BaseMatcher<T> org.hamcrest.TypeSafeMatcher<java.util.Map<? extends K,? extends V>> org.hamcrest.collection.IsMapContaining<K,V>
public class IsMapContaining<K,V>
Constructor Summary | |
---|---|
IsMapContaining(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
|
Method Summary | ||
---|---|---|
void |
describeMismatchSafely(java.util.Map<? extends K,? extends V> map,
Description mismatchDescription)
Subclasses should override this. |
|
void |
describeTo(Description description)
Generates a description of the object. |
|
static
|
hasEntry(K key,
V value)
Creates a matcher for Map s matching when the examined Map contains
at least one entry whose key equals the specified key and whose value equals the
specified value . |
|
static
|
hasEntry(Matcher<? super K> keyMatcher,
Matcher<? super V> valueMatcher)
Creates a matcher for Map s matching when the examined Map contains
at least one entry whose key satisfies the specified keyMatcher and whose
value satisfies the specified valueMatcher . |
|
static
|
hasKey(K key)
Creates a matcher for Map s matching when the examined Map contains
at least one key that is equal to the specified key. |
|
static
|
hasKey(Matcher<? super K> keyMatcher)
Creates a matcher for Map s matching when the examined Map contains
at least one key that satisfies the specified matcher. |
|
static
|
hasValue(Matcher<? super V> valueMatcher)
Creates a matcher for Map s matching when the examined Map contains
at least one value that satisfies the specified valueMatcher. |
|
static
|
hasValue(V value)
Creates a matcher for Map s matching when the examined Map contains
at least one value that is equal to the specified value. |
|
boolean |
matchesSafely(java.util.Map<? extends K,? extends V> map)
Subclasses should implement this. |
Methods inherited from class org.hamcrest.TypeSafeMatcher |
---|
describeMismatch, matches |
Methods inherited from class org.hamcrest.BaseMatcher |
---|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IsMapContaining(Matcher<? super K> keyMatcher, Matcher<? super V> valueMatcher)
Method Detail |
---|
public boolean matchesSafely(java.util.Map<? extends K,? extends V> map)
TypeSafeMatcher
matchesSafely
in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
public void describeMismatchSafely(java.util.Map<? extends K,? extends V> map, Description mismatchDescription)
TypeSafeMatcher
describeMismatchSafely
in class TypeSafeMatcher<java.util.Map<? extends K,? extends V>>
public void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.public static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(Matcher<? super K> keyMatcher, Matcher<? super V> valueMatcher)
Map
s matching when the examined Map
contains
at least one entry whose key satisfies the specified keyMatcher
and whose
value satisfies the specified valueMatcher
.
For example:
assertThat(myMap, hasEntry(equalTo("bar"), equalTo("foo")))
keyMatcher
- the key matcher that, in combination with the valueMatcher, must be satisfied by at least one entryvalueMatcher
- the value matcher that, in combination with the keyMatcher, must be satisfied by at least one entrypublic static <K,V> Matcher<java.util.Map<? extends K,? extends V>> hasEntry(K key, V value)
Map
s matching when the examined Map
contains
at least one entry whose key equals the specified key
and whose value equals the
specified value
.
For example:
assertThat(myMap, hasEntry("bar", "foo"))
key
- the key that, in combination with the value, must be describe at least one entryvalue
- the value that, in combination with the key, must be describe at least one entrypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher)
Map
s matching when the examined Map
contains
at least one key that satisfies the specified matcher.
For example:
assertThat(myMap, hasKey(equalTo("bar")))
keyMatcher
- the matcher that must be satisfied by at least one keypublic static <K> Matcher<java.util.Map<? extends K,?>> hasKey(K key)
Map
s matching when the examined Map
contains
at least one key that is equal to the specified key.
For example:
assertThat(myMap, hasKey("bar"))
key
- the key that satisfying maps must containpublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(Matcher<? super V> valueMatcher)
Map
s matching when the examined Map
contains
at least one value that satisfies the specified valueMatcher.
For example:
assertThat(myMap, hasValue(equalTo("foo")))
valueMatcher
- the matcher that must be satisfied by at least one valuepublic static <V> Matcher<java.util.Map<?,? extends V>> hasValue(V value)
Map
s matching when the examined Map
contains
at least one value that is equal to the specified value.
For example:
assertThat(myMap, hasValue("foo"))
value
- the value that satisfying maps must contain
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |