クラス MapContentMatchers< T , V >

java.lang.ObjectSE
org.hamcrest.BaseMatcher<MapSE<? super T, ? super V>>
org.hamcrest.TypeSafeMatcher<MapSE<? super T, ? super V>>
org.springframework.integration.test.matcher.MapContentMatchers<T,V>
実装済みのインターフェース一覧:
org.hamcrest.Matcher<MapSE<? super T, ? super V>>, org.hamcrest.SelfDescribing

public final class MapContentMatchers<T,V> extends org.hamcrest.TypeSafeMatcher<MapSE<? super T, ? super V>>
MapSE の内容を調べるマッチャー。

次のように、値またはマッチャーによって単一のエントリを照合することができます。

assertThat(map, hasEntry(SOME_KEY, is(SOME_VALUE)));
assertThat(map, hasEntry(SOME_KEY, is(String.class)));
assertThat(map, hasEntry(SOME_KEY, notNullValue()));

マップ内の複数のエントリを照合することもできます。


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));

キーの存在を確認するだけでよい場合:

assertThat(map, hasKey(SOME_KEY));
作成者:
Alex Peters, Iwein Fuld, Gunnar Hillert, Artem Bilan, Gary Russell
  • 方法の概要

    修飾子と型
    メソッド
    説明
    void
    describeTo(org.hamcrest.Description description)
    static <T,V> org.hamcrest.Matcher<MapSE<T,V>>
    hasAllEntries(MapSE<T,V> entries)
    boolean
    matchesSafely(MapSE<? super T, ? super V> item)

    クラス org.hamcrest.TypeSafeMatcher から継承されたメソッド

    describeMismatch, describeMismatchSafely, matches

    クラス org.hamcrest.BaseMatcher から継承されたメソッド

    _dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString

    クラス ObjectSE から継承されたメソッド

    clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSE
  • 方法の詳細

    • matchesSafely

      public boolean matchesSafely(MapSE<? super T, ? super V> item)
      次で指定:
      クラス org.hamcrest.TypeSafeMatcher<MapSE<? super T, ? super V>>matchesSafely 
    • describeTo

      public void describeTo(org.hamcrest.Description description)
    • hasAllEntries

      public static <T,V> org.hamcrest.Matcher<MapSE<T,V>> hasAllEntries(MapSE<T,V> entries)