public class ValueReturningMockBehavior extends Object implements ValidatableMockBehavior
| Constructor and Description |
|---|
ValueReturningMockBehavior(Object valueToReturn)
Creates the returning behavior for the given value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertCanExecute(ProxyInvocation proxyInvocation)
Checks whether the mock behavior can be executed for the given invocation.
|
Object |
execute(ProxyInvocation proxyInvocation)
Executes the mock behavior.
|
protected Object |
unwrapValueToReturnIfNeeded(Object valueToReturn)
If the value to return is an wrapper object, e.g. a mock, this will return the wrapped instance instead
of the wrapper.
|
public ValueReturningMockBehavior(Object valueToReturn)
valueToReturn - The valuepublic void assertCanExecute(ProxyInvocation proxyInvocation) throws UnitilsException
assertCanExecute in interface ValidatableMockBehaviorproxyInvocation - The proxy method invocation, not nullUnitilsExceptionpublic Object execute(ProxyInvocation proxyInvocation)
execute in interface MockBehaviorproxyInvocation - The proxy method invocation, not nullprotected Object unwrapValueToReturnIfNeeded(Object valueToReturn)
valueToReturn - The return valueCopyright © 2016. All Rights Reserved.