|
Spring Integration | |||||||||
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(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(Object item)
Method made final to prevent accidental override. |
|
boolean |
matchesSafely(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(Map<? super T,? super V> item)
public void describeTo(org.hamcrest.Description description)
public static <T,V> org.hamcrest.Matcher<Map<? super T,? super V>> hasEntry(T key, V value)
public static <T,V> org.hamcrest.Matcher<Map<? super T,? super V>> hasEntry(T key, org.hamcrest.Matcher<V> valueMatcher)
public static <T,V> org.hamcrest.Matcher<Map<? super T,? super V>> hasKey(T key)
public static <T,V> org.hamcrest.Matcher<Map<? super T,? super V>> hasAllEntries(Map<T,V> entries)
public final boolean matches(Object item)
BaseMatcher
.
|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |