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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.camunda.bpm.engine.runtime.MessageCorrelationBuilder
    answer(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.MessageCorrelationBuilder
    Create builder mock with fluent answer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FluentMessageCorrelationBuilderAnswer

      public FluentMessageCorrelationBuilderAnswer()
  • Method Details

    • 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