com.greenpepper.call.ResultHandler Maven / Gradle / Ivy
The newest version!
package com.greenpepper.call;
/**
* ResultHandler class.
*
* @author oaouattara
* @version $Id: $Id
*/
public class ResultHandler implements StubSyntax
{
private final Stub stub;
private ResultMatcher matcher;
/**
* Constructor for ResultHandler.
*
* @param stub a {@link com.greenpepper.call.Stub} object.
*/
public ResultHandler( Stub stub )
{
this.stub = stub;
this.matcher = new AnyResult();
}
/** {@inheritDoc} */
public void when( ResultMatcher matcher )
{
this.matcher = matcher;
}
/**
* handle.
*
* @param result a {@link com.greenpepper.call.Result} object.
*/
public void handle( Result result )
{
if (matcher.matches( result )) stub.call( result );
}
}