org.jmock.core.constraint
Class HasProperty

java.lang.Object
  extended by org.jmock.core.constraint.HasProperty
All Implemented Interfaces:
Constraint, SelfDescribing

public class HasProperty
extends Object
implements Constraint

Constraint that checks that an object has a JavaBean property with the specified name. If an error occurs while introspecting the object then this is treated as a constraint failure.

Since:
1.1.0
Author:
Iain McGinniss, Nat Pryce, Steve Freeman

Constructor Summary
HasProperty(String propertyName)
           
 
Method Summary
 StringBuffer describeTo(StringBuffer buffer)
          Appends the description of this object to the buffer.
 boolean eval(Object obj)
          Evaluates the constraint for argument o.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HasProperty

public HasProperty(String propertyName)
Method Detail

eval

public boolean eval(Object obj)
Description copied from interface: Constraint
Evaluates the constraint for argument o.

Specified by:
eval in interface Constraint
Parameters:
obj - the object against which the constraint is evaluated.
Returns:
true if o meets the constraint, false if it does not.

describeTo

public StringBuffer describeTo(StringBuffer buffer)
Description copied from interface: SelfDescribing
Appends the description of this object to the buffer.

Specified by:
describeTo in interface SelfDescribing
Parameters:
buffer - The buffer that the description is appended to.
Returns:
The buffer passed to the invokedMethod.