Class FluentMessageCorrelationBuilderAnswer
- java.lang.Object
-
- org.camunda.community.mockito.answer.FluentMessageCorrelationBuilderAnswer
-
- All Implemented Interfaces:
org.mockito.stubbing.Answer<org.camunda.bpm.engine.runtime.MessageCorrelationBuilder>
public final class FluentMessageCorrelationBuilderAnswer extends Object implements org.mockito.stubbing.Answer<org.camunda.bpm.engine.runtime.MessageCorrelationBuilder>
A fluent answer always returns the mock instance itself for all methods that have the same return type as the mock instance. This makes it possible to easily mock fluent-api behaviour without chaining the when/then stubbings or relying on deep stubs.
-
-
Constructor Summary
Constructors Constructor Description FluentMessageCorrelationBuilderAnswer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.camunda.bpm.engine.runtime.MessageCorrelationBuilderanswer(org.mockito.invocation.InvocationOnMock invocation)Returns the mock itself if return type and mock type match (assume fluent api).static org.camunda.bpm.engine.runtime.MessageCorrelationBuildercreateMock()Create builder mock with fluent answer.
-
-
-
Method Detail
-
createMock
public static org.camunda.bpm.engine.runtime.MessageCorrelationBuilder createMock()
Create builder mock with fluent answer.- Returns:
- fluent mock.
-
answer
public org.camunda.bpm.engine.runtime.MessageCorrelationBuilder answer(@Nonnull org.mockito.invocation.InvocationOnMock invocation) throws ThrowableReturns the mock itself if return type and mock type match (assume fluent api).- Specified by:
answerin interfaceorg.mockito.stubbing.Answer<org.camunda.bpm.engine.runtime.MessageCorrelationBuilder>- Parameters:
invocation- the method invocation. If its return type equals the mock type, just return the mock.- Returns:
- the mock itself or null (meaning further stubbing is required).
- Throws:
Throwable- when anything fails
-
-