OCHamcrest
Public Member Functions
<HCMatcher> Protocol Reference

A matcher over acceptable values. More...

Inheritance diagram for <HCMatcher>:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(BOOL) - matches:
 Evaluates the matcher for argument item.
(BOOL) - matches:describingMismatchTo:
 Evaluates the matcher for argument item.
(void) - describeMismatchOf:to:
 Generates a description of why the matcher has not accepted the item.

Detailed Description

A matcher over acceptable values.

A matcher is able to describe itself to give feedback when it fails.

HCMatcher implementations should not directly implement this protocol. Instead, extend the HCBaseMatcher class, which will ensure that the HCMatcher API can grow to support new features and remain compatible with all HCMatcher implementations.


Member Function Documentation

- (void) describeMismatchOf: (id)  item
to: (id< HCDescription >)  mismatchDescription 

Generates a description of why the matcher has not accepted the item.

The description will be part of a larger description of why a matching failed, so it should be concise.

This method assumes that matches:item is false, but will not check this.

Parameters:
itemThe item that the HCMatcher has rejected.
mismatchDescriptionThe description to be built or appended to.
- (BOOL) matches: (id)  item

Evaluates the matcher for argument item.

Parameters:
itemThe object against which the matcher is evaluated.
Returns:
YES if item matches, otherwise NO.
- (BOOL) matches: (id)  item
describingMismatchTo: (id< HCDescription >)  mismatchDescription 

Evaluates the matcher for argument item.

Parameters:
itemThe object against which the matcher is evaluated.
mismatchDescriptionThe description to be built or appended to if item does not match.
Returns:
YES if item matches, otherwise NO.