Class 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 Detail

      • FluentMessageCorrelationBuilderAnswer

        public FluentMessageCorrelationBuilderAnswer()
    • 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 Throwable
        Returns the mock itself if return type and mock type match (assume fluent api).
        Specified by:
        answer in interface org.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