Class MessagePropertyMatcher<P>
- java.lang.Object
-
- org.hamcrest.BaseMatcher<T>
-
- org.hamcrest.TypeSafeMatcher<org.faktorips.runtime.Message>
-
- org.faktorips.testsupport.matchers.MessageMatcher
-
- org.faktorips.testsupport.matchers.MessagePropertyMatcher<P>
-
- Type Parameters:
P- the property type to match
- All Implemented Interfaces:
org.hamcrest.Matcher<org.faktorips.runtime.Message>,org.hamcrest.SelfDescribing
public class MessagePropertyMatcher<P> extends MessageMatcher
Creates aMessageMatcherthat extracts a property of type <P> from aMessageand matches it with a given matcher.- Since:
- 22.6
-
-
Constructor Summary
Constructors Constructor Description MessagePropertyMatcher(java.util.function.Function<org.faktorips.runtime.Message,P> propertyExtractor, org.hamcrest.Matcher<P> propertyMatcher, java.lang.String propertyDescription)Creates a newMessageMatcherthat extracts a property of type <P> from aMessageand matches it with the given matcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddescribeMessageProperty(org.hamcrest.Description description)Adds the description of the property checked by this matcher to the given description.protected 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 booleanmatchesSafely(org.faktorips.runtime.Message item)-
Methods inherited from class org.faktorips.testsupport.matchers.MessageMatcher
and, describeMismatchSafely, describeTo
-
-
-
-
Constructor Detail
-
MessagePropertyMatcher
public MessagePropertyMatcher(java.util.function.Function<org.faktorips.runtime.Message,P> propertyExtractor, org.hamcrest.Matcher<P> propertyMatcher, java.lang.String propertyDescription)
Creates a newMessageMatcherthat extracts a property of type <P> from aMessageand matches it with the given matcher.- Parameters:
propertyExtractor- the function to get the property from the objectpropertyMatcher- the matcher for the propertypropertyDescription- the description of the object and property (e.g. "a car where the color is") that will be combined with the description of the given matcher
-
-
Method Detail
-
matchesSafely
protected boolean matchesSafely(org.faktorips.runtime.Message item)
- Specified by:
matchesSafelyin classorg.hamcrest.TypeSafeMatcher<org.faktorips.runtime.Message>
-
describeMismatchedProperty
protected void describeMismatchedProperty(org.faktorips.runtime.Message message, org.hamcrest.Description mismatchDescription)Description copied from class:MessageMatcherAdds the description of the given message's actual value of the property checked by this matcher to the given description.- Specified by:
describeMismatchedPropertyin classMessageMatcher
-
describeMessageProperty
protected void describeMessageProperty(org.hamcrest.Description description)
Description copied from class:MessageMatcherAdds the description of the property checked by this matcher to the given description.- Specified by:
describeMessagePropertyin classMessageMatcher
-
-