Class LambdaAnswer<T>
- java.lang.Object
-
- org.mockito.internal.stubbing.defaultanswers.ForwardsInvocations
-
- org.springframework.amqp.rabbit.test.mockito.LambdaAnswer<T>
-
- Type Parameters:
T
- the return type.
- All Implemented Interfaces:
Serializable
,org.mockito.stubbing.Answer<Object>
public class LambdaAnswer<T> extends org.mockito.internal.stubbing.defaultanswers.ForwardsInvocations
AnAnswer
to optionally call the real method and allow returning a custom result. Captures any exceptions thrown.- Since:
- 1.6
- Author:
- Gary Russell
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LambdaAnswer.ValueToReturn<T>
-
Constructor Summary
Constructors Constructor Description LambdaAnswer(boolean callRealMethod, LambdaAnswer.ValueToReturn<T> callback)
Deprecated.in favor ofLambdaAnswer(boolean, ValueToReturn, Object)
.LambdaAnswer(boolean callRealMethod, LambdaAnswer.ValueToReturn<T> callback, Object delegate)
Construct an instance with the provided properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
answer(org.mockito.invocation.InvocationOnMock invocation)
Collection<Exception>
getExceptions()
Return the exceptions thrown, if any.
-
-
-
Constructor Detail
-
LambdaAnswer
@Deprecated public LambdaAnswer(boolean callRealMethod, LambdaAnswer.ValueToReturn<T> callback)
Deprecated.in favor ofLambdaAnswer(boolean, ValueToReturn, Object)
.Deprecated.- Parameters:
callRealMethod
- true to call the real method.callback
- the callback.
-
LambdaAnswer
public LambdaAnswer(boolean callRealMethod, LambdaAnswer.ValueToReturn<T> callback, @Nullable Object delegate)
Construct an instance with the provided properties. Use the test harness to get an instance with the proper delegate.- Parameters:
callRealMethod
- true to call the real method.callback
- the call back to receive the result.delegate
- the delegate.
-
-
Method Detail
-
getExceptions
public Collection<Exception> getExceptions()
Return the exceptions thrown, if any.- Returns:
- the exceptions.
- Since:
- 2.2.3
-
-