org.unitils.mock.mockbehavior.impl
Class DefaultValueReturningMockBehavior

java.lang.Object
  extended by org.unitils.mock.mockbehavior.impl.DefaultValueReturningMockBehavior
All Implemented Interfaces:
MockBehavior, ValidatableMockBehavior

public class DefaultValueReturningMockBehavior
extends java.lang.Object
implements ValidatableMockBehavior

Mock behavior that returns a default value.

Following defaults are used:

Author:
Filip Neven, Tim Ducheyne, Kenny Claes

Constructor Summary
DefaultValueReturningMockBehavior()
           
 
Method Summary
 void assertCanExecute(ProxyInvocation proxyInvocation)
          Checks whether the mock behavior can be executed for the given invocation.
 java.lang.Object execute(ProxyInvocation proxyInvocation)
          Executes the mock behavior.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultValueReturningMockBehavior

public DefaultValueReturningMockBehavior()
Method Detail

assertCanExecute

public void assertCanExecute(ProxyInvocation proxyInvocation)
                      throws UnitilsException
Checks whether the mock behavior can be executed for the given invocation. An exception is raised if the method is a void method.

Specified by:
assertCanExecute in interface ValidatableMockBehavior
Parameters:
proxyInvocation - The proxy method invocation, not null
Throws:
UnitilsException

execute

public java.lang.Object execute(ProxyInvocation proxyInvocation)
Executes the mock behavior.

Specified by:
execute in interface MockBehavior
Parameters:
proxyInvocation - The proxy method invocation, not null
Returns:
The default value


Copyright © 2009. All Rights Reserved.