|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hamcrest.BaseMatcher<T> org.springframework.integration.test.matcher.MapContentMatchers<T,V>
public class MapContentMatchers<T,V>
Matchers that examine the contents of a Map
.
It is possible to match a single entry by value or matcher like this:
assertThat(map, hasEntry(SOME_KEY, is(SOME_VALUE))); assertThat(map, hasEntry(SOME_KEY, is(String.class))); assertThat(map, hasEntry(SOME_KEY, notNullValue()));
It's also possible to match multiple entries in a map:
Map<String, Object> expectedInMap = new HashMap<String, Object>(); expectedInMap.put(SOME_KEY, SOME_VALUE); expectedInMap.put(OTHER_KEY, is(OTHER_VALUE)); assertThat(map, hasAllEntries(expectedInMap));
If you only need to verify the existence of a key:
assertThat(map, hasKey(SOME_KEY));
Method Summary | ||
---|---|---|
void |
describeTo(org.hamcrest.Description description)
|
|
static
|
hasAllEntries(java.util.Map<T,V> entries)
|
|
static
|
hasEntry(T key,
org.hamcrest.Matcher<V> valueMatcher)
|
|
static
|
hasEntry(T key,
V value)
|
|
static
|
hasKey(T key)
|
|
boolean |
matches(java.lang.Object item)
Method made final to prevent accidental override. |
|
boolean |
matchesSafely(java.util.Map<? super T,? super V> item)
Subclasses should implement this. |
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 |
Method Detail |
---|
public boolean matchesSafely(java.util.Map<? super T,? super V> item)
public void describeTo(org.hamcrest.Description description)
public static <T,V> org.hamcrest.Matcher<java.util.Map<? super T,? super V>> hasEntry(T key, V value)
public static <T,V> org.hamcrest.Matcher<java.util.Map<? super T,? super V>> hasEntry(T key, org.hamcrest.Matcher<V> valueMatcher)
public static <T,V> org.hamcrest.Matcher<java.util.Map<? super T,? super V>> hasKey(T key)
public static <T,V> org.hamcrest.Matcher<java.util.Map<? super T,? super V>> hasAllEntries(java.util.Map<T,V> entries)
public final boolean matches(java.lang.Object item)
BaseMatcher
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |