Class MessageMatcher

java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<org.faktorips.runtime.Message>
org.faktorips.testsupport.matchers.MessageMatcher
All Implemented Interfaces:
org.hamcrest.Matcher<org.faktorips.runtime.Message>, org.hamcrest.SelfDescribing
Direct Known Subclasses:
MessageCodeMatcher, MessageInvalidObjectMatcher, MessageMarkerMatcher, MessagePropertyMatcher, MessageSeverityMatcher

public abstract class MessageMatcher extends org.hamcrest.TypeSafeMatcher<org.faktorips.runtime.Message>
A typesafe Matcher for a Message.
Implementation Requirements:
the methods describeMessageProperty(Description) and describeMismatchedProperty(Message, Description) should only describe the matched property; they will be combined with a leading "a message that " when this matcher is used as is and embedded in more descriptive messages when used with and(MessageMatcher) or a MessageListMessageMatcher as created by IpsMatchers.hasMessages(Matcher...).
Since:
22.6
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Combines this MessageMatcher with another MessageMatcher creating a MessageMatcher that only matches if both original matchers match.
    protected abstract void
    describeMessageProperty(org.hamcrest.Description description)
    Adds the description of the property checked by this matcher to the given description.
    protected abstract void
    describeMismatchedProperty(org.faktorips.runtime.Message message, org.hamcrest.Description mismatchDescription)
    Adds the description of the given message's actual value of the property checked by this matcher to the given description.
    protected void
    describeMismatchSafely(org.faktorips.runtime.Message message, org.hamcrest.Description mismatchDescription)
    void
    describeTo(org.hamcrest.Description description)

    Methods inherited from class org.hamcrest.TypeSafeMatcher

    describeMismatch, matches, matchesSafely

    Methods inherited from class org.hamcrest.BaseMatcher

    _dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MessageMatcher

      public MessageMatcher()
  • Method Details

    • describeTo

      public void describeTo(org.hamcrest.Description description)
      Implementation Note:
      uses describeMessageProperty(Description) to describe the property the message should have
    • describeMessageProperty

      protected abstract void describeMessageProperty(org.hamcrest.Description description)
      Adds the description of the property checked by this matcher to the given description.
    • describeMismatchSafely

      protected void describeMismatchSafely(org.faktorips.runtime.Message message, org.hamcrest.Description mismatchDescription)
      Overrides:
      describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<org.faktorips.runtime.Message>
      Implementation Note:
      uses describeMismatchedProperty(Message, Description) to describe the property the actually has
    • describeMismatchedProperty

      protected abstract void describeMismatchedProperty(org.faktorips.runtime.Message message, org.hamcrest.Description mismatchDescription)
      Adds the description of the given message's actual value of the property checked by this matcher to the given description.
    • and

      public MessageMatcher and(MessageMatcher other)
      Combines this MessageMatcher with another MessageMatcher creating a MessageMatcher that only matches if both original matchers match.