クラス PayloadMatcher<T>

java.lang.ObjectSE
org.hamcrest.BaseMatcher<Message<?>>
org.hamcrest.TypeSafeMatcher<Message<?>>
org.springframework.integration.test.matcher.PayloadMatcher<T>
実装されたすべてのインターフェース:
org.hamcrest.Matcher<Message<?>>org.hamcrest.SelfDescribing

public final class PayloadMatcher<T> extends org.hamcrest.TypeSafeMatcher<Message<?>>
Message のペイロードは指定された値に等しいですか、それとも指定されたマッチャーと一致していますか?

Assert.assertThat(Object, Matcher) を使用した JUnit の例は、ペイロード値をテストするために次のようになります。

 
 ANY_PAYLOAD = new BigDecimal("1.123");
 Message<BigDecimal> message = MessageBuilder.withPayload(ANY_PAYLOAD).build();
 assertThat(message, hasPayload(ANY_PAYLOAD));
 
 

別の Matcher に委譲する Assert.assertThat(Object, Matcher) を使用する例。

 
 ANY_PAYLOAD = new BigDecimal("1.123");
 Message<BigDecimal> message = MessageBuilder.withPayload(ANY_PAYLOAD).build();
 assertThat(message, PayloadMatcher.hasPayload(is(BigDecimal.class)));
 assertThat(message, PayloadMatcher.hasPayload(notNullValue()));
 assertThat(message, not((PayloadMatcher.hasPayload(is(String.class))))); *
 
 
作成者:
Alex Peters, Iwein Fuld, Artem Bilan, Gary Russell
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    void
    describeTo(org.hamcrest.Description description)
    static <P> PayloadMatcher<P>
    hasPayload(org.hamcrest.Matcher<P> payloadMatcher)
    static <P> PayloadMatcher<P>
    hasPayload(P payload)
    boolean

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

    describeMismatch, describeMismatchSafely, matches

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

    _dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString

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

    clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSE
  • メソッドの詳細

    • matchesSafely

      public boolean matchesSafely(Message<?> message)
      次で指定:
      クラス org.hamcrest.TypeSafeMatcher<Message<?>>matchesSafely 
    • describeTo

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

      public static <P> PayloadMatcher<P> hasPayload(P payload)
    • hasPayload

      public static <P> PayloadMatcher<P> hasPayload(org.hamcrest.Matcher<P> payloadMatcher)