// OCHamcrest by Jon Reid, https://qualitycoding.org/ // Copyright 2019 hamcrest.org. See LICENSE.txt // Contribution by Justin Shacklette #import NS_ASSUME_NONNULL_BEGIN /*! * @abstract Matches objects whose "property" (or simple method) satisfies a nested matcher. */ @interface HCHasProperty : HCDiagnosingMatcher - (instancetype)initWithProperty:(NSString *)propertyName value:(id )valueMatcher NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @end FOUNDATION_EXPORT id HC_hasProperty(NSString *propertyName, _Nullable id valueMatcher); #ifndef HC_DISABLE_SHORT_SYNTAX /*! * @abstract Creates a matcher that matches when the examined object has an instance method with the * specified name whose return value satisfies the specified matcher. * @param propertyName The name of an instance method without arguments that returns an object. * @param valueMatcher The matcher to satisfy for the return value, or an expected value for * equalTo matching. * @discussion Note: While this matcher factory is called "hasProperty", it applies to the return * values of any instance methods without arguments, not just properties. * * Examples
*
assertThat(person, hasProperty(\@"firstName", equalTo(\@"Joe")))
*
assertThat(person, hasProperty(\@"firstName", \@"Joe"))
* * Name Clash
* In the event of a name clash, #define HC_DISABLE_SHORT_SYNTAX and use the synonym * HC_hasProperty instead. */ static inline id hasProperty(NSString *propertyName, _Nullable id valueMatcher) { return HC_hasProperty(propertyName, valueMatcher); } #endif NS_ASSUME_NONNULL_END