クラス PayloadMatcher<T>
- 実装されたすべてのインターフェース:
org.hamcrest.Matcher<Message<?>>
,org.hamcrest.SelfDescribing
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
matchesSafely
(Message<?> message) クラス org.hamcrest.TypeSafeMatcher から継承されたメソッド
describeMismatch, describeMismatchSafely, matches
クラス org.hamcrest.BaseMatcher から継承されたメソッド
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
メソッドの詳細
matchesSafely
describeTo
public void describeTo(org.hamcrest.Description description) hasPayload
hasPayload