Logo Search packages:      
Sourcecode: jmock2 version File versions  Download package

Object org::jmock::internal::ReturnDefaultValueAction::invoke ( Invocation  invocation  )  throws Throwable [inline]

Performs an action in response to an invocation.

invocation The invocation to perform.
The result of the invocation, if not throwing an exception. Must return null if the invoked method has a void return type.
Throwable An exception to be thrown to the caller, if not returning a value. Any checked exception thrown must be in the throws list of the invoked method.

Implements org::jmock::api::Invokable.

Definition at line 52 of file ReturnDefaultValueAction.java.

References org::jmock::api::Imposteriser::canImposterise(), and org::jmock::api::Imposteriser::imposterise().

        Class<?> returnType = invocation.getInvokedMethod().getReturnType();

        if (resultValuesByType.containsKey(returnType)) {
            return resultValuesByType.get(returnType);
        else if (returnType.isArray()) {
            return Array.newInstance(returnType.getComponentType(), 0);
        else if (imposteriser.canImposterise(returnType)) {
            return imposteriser.imposterise(this, returnType);
        else {
            return null;

Generated by  Doxygen 1.6.0   Back to index