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 typesafeMatcherfor aMessage.- Since:
- 22.6
- Implementation Requirements:
- the methods
describeMessageProperty(Description)anddescribeMismatchedProperty(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 withand(MessageMatcher)or aMessageListMessageMatcheras created byIpsMatchers.hasMessages(Matcher...).
-
-
Constructor Summary
Constructors Constructor Description MessageMatcher()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description MessageMatcherand(MessageMatcher other)Combines thisMessageMatcherwith anotherMessageMatchercreating aMessageMatcherthat only matches if both original matchers match.protected abstract voiddescribeMessageProperty(org.hamcrest.Description description)Adds the description of the property checked by this matcher to the given description.protected abstract voiddescribeMismatchedProperty(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 voiddescribeMismatchSafely(org.faktorips.runtime.Message message, org.hamcrest.Description mismatchDescription)voiddescribeTo(org.hamcrest.Description description)
-
-
-
Method Detail
-
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:
describeMismatchSafelyin classorg.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 thisMessageMatcherwith anotherMessageMatchercreating aMessageMatcherthat only matches if both original matchers match.
-
-