Top Description Fields Constructors Methods
org.hamcrest.integration

public Class JMock1Adapter

extends Object
implements Constraint
Class Inheritance
All Implemented Interfaces
org.jmock.core.Constraint, org.jmock.core.SelfDescribing
Imports
org.jmock.core.Constraint, org.hamcrest.Matcher, .StringDescription

An adapter allowing a Hamcrest org.hamcrest.Matcher to act as an jMock1 org.jmock.core.Constraint. Note, this is not necessary for jMock2 as it supports Hamcrest out of the box.
Author
Joe Walnes

Field Summary

Modifier and TypeField and Description
private final Matcher<?>

Constructor Summary

AccessConstructor and Description
public
JMock1Adapter(Matcher<?> matcher)

Method Summary

Modifier and TypeMethod and Description
public static Constraint
adapt(Matcher<?> matcher)

Convenience factory method that will adapt a Hamcrest org.hamcrest.Matcher to act as an jMock org.jmock.core.Constraint.

public StringBuffer
describeTo(StringBuffer
The buffer that the description is appended to.
buffer
)

Implements org.jmock.core.SelfDescribing.describeTo.

Appends the description of this object to the buffer.
public boolean
eval(Object
the object against which the constraint is evaluated.
o
)

Implements org.jmock.core.Constraint.eval.

Evaluates the constraint for argument o.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hamcrestMatcherback to summary
private final Matcher<?> hamcrestMatcher

Constructor Detail

JMock1Adapterback to summary
public JMock1Adapter(Matcher<?> matcher)

Method Detail

adaptback to summary
public static Constraint adapt(Matcher<?> matcher)

Convenience factory method that will adapt a Hamcrest org.hamcrest.Matcher to act as an jMock org.jmock.core.Constraint.

describeToback to summary
public StringBuffer describeTo(StringBuffer buffer)

Implements org.jmock.core.SelfDescribing.describeTo.

Doc from org.jmock.core.SelfDescribing.describeTo.

Appends the description of this object to the buffer.

Parameters
buffer:StringBuffer

The buffer that the description is appended to.

Returns:StringBuffer

The buffer passed to the invokedMethod.

Annotations
@Override
evalback to summary
public boolean eval(Object o)

Implements org.jmock.core.Constraint.eval.

Doc from org.jmock.core.Constraint.eval.

Evaluates the constraint for argument o.

Parameters
o:Object

the object against which the constraint is evaluated.

Returns:boolean

true if o meets the constraint, false if it does not.

Annotations
@Override