Enum CamundaMockito

    • Method Detail

      • values

        public static CamundaMockito[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CamundaMockito c : CamundaMockito.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CamundaMockito valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • autoMock

        public static void autoMock​(@Nonnull
                                    String bpmnFileResource)
        Takes a BPMN resource and registers mocks for all delegateExpressions.
        Parameters:
        bpmnFileResource - the bpm file resource to parse
        See Also:
        autoMock(java.net.URL)
      • autoMock

        public static void autoMock​(@Nonnull
                                    URL bpmnFile)
        Takes a BPMN file and registers TaskListener-, ExecutionListener and JavaDelegate-Mocks for every delegateExpression encountered.

        This is an auto-mock feature that allows the process to run. If you need to modify the behavior of the mock, you can use the getXXX() methods to access it by its name.

        Parameters:
        bpmnFile - the BPMN resource to parse
      • registerJavaDelegateMock

        public static FluentJavaDelegateMock registerJavaDelegateMock​(Class<? extends org.camunda.bpm.engine.delegate.JavaDelegate> type)
        Registers a new FluentJavaDelegateMock instance for name (by type).
        Parameters:
        type - the type to register
        Returns:
        new fluent-mock instance
      • registerExecutionListenerMock

        public static FluentExecutionListenerMock registerExecutionListenerMock​(Class<? extends org.camunda.bpm.engine.delegate.ExecutionListener> type)
        Registers a new FluentExecutionListenerMock instance for name (by type).
        Parameters:
        type - the type to register
        Returns:
        new fluent-mock instance
      • registerTaskListenerMock

        public static FluentTaskListenerMock registerTaskListenerMock​(Class<? extends org.camunda.bpm.engine.delegate.TaskListener> type)
        Registers a new FluentTaskListenerMock instance for name (by type).
        Parameters:
        type - the type to register
        Returns:
        new fluent-mock instance
      • getJavaDelegateMock

        public static FluentJavaDelegateMock getJavaDelegateMock​(String name)
        Returns the registered FluentJavaDelegateMock instance for name.
        Parameters:
        name - the name under which the instance is registered
        Returns:
        the registered fluent-mock instance
        See Also:
        Expressions.getRegistered(String)
      • getExecutionListenerMock

        public static FluentExecutionListenerMock getExecutionListenerMock​(String name)
        Returns the registered FluentExecutionListenerMock instance for name.
        Parameters:
        name - the name under which the instance is registered
        Returns:
        the registered fluent-mock instance
        See Also:
        Expressions.getRegistered(String)
      • getTaskListenerMock

        public static FluentTaskListenerMock getTaskListenerMock​(String name)
        Returns the registered FluentTaskListenerMock instance for name.
        Parameters:
        name - the name under which the instance is registered
        Returns:
        the registered fluent-mock instance
        See Also:
        Expressions.getRegistered(String)
      • verifyJavaDelegateMock

        public static MockitoVerification<org.camunda.bpm.engine.delegate.DelegateExecution> verifyJavaDelegateMock​(Class<?> type)
        Gets the registered FluentJavaDelegateMock and creates a verification instance.
        Parameters:
        type - the type of the delegate to lookup
        Returns:
        verifcation for JavaDelegate
      • verifyJavaDelegateMock

        public static MockitoVerification<org.camunda.bpm.engine.delegate.DelegateExecution> verifyJavaDelegateMock​(FluentJavaDelegateMock fluentJavaDelegateMock)
        Creates a verification instance for JavaDelegate.
        Parameters:
        fluentJavaDelegateMock - the fluent-mock instance
        Returns:
        verification for JavaDelegate
      • verifyExecutionListenerMock

        public static MockitoVerification<org.camunda.bpm.engine.delegate.DelegateExecution> verifyExecutionListenerMock​(Class<?> type)
        Gets the registered FluentExecutionListenerMock and creates a verification instance.
        Parameters:
        type - the type of the listener to lookup
        Returns:
        verification for ExecutionListener
      • verifyExecutionListenerMock

        public static MockitoVerification<org.camunda.bpm.engine.delegate.DelegateExecution> verifyExecutionListenerMock​(FluentExecutionListenerMock fluentExecutionListenerMock)
        Creates a verification instance for ExecutionListener.
        Parameters:
        fluentExecutionListenerMock - the fluent-mock instance
        Returns:
        verification for JavaDelegate
      • verifyTaskListenerMock

        public static MockitoVerification<org.camunda.bpm.engine.delegate.DelegateTask> verifyTaskListenerMock​(Class<?> type)
        Gets the registered FluentExecutionListenerMock and creates a verification instance.
        Parameters:
        type - the type of the listener to lookup
        Returns:
        verification for TaskListener
      • verifyTaskListenerMock

        public static MockitoVerification<org.camunda.bpm.engine.delegate.DelegateTask> verifyTaskListenerMock​(FluentTaskListenerMock fluentTaskListenerMock)
        Creates a verification instance for TaskListener.
        Parameters:
        fluentTaskListenerMock - the fluent-mock instance
        Returns:
        verification for TaskListener
      • registerMockInstancesForNestedTypes

        public static void registerMockInstancesForNestedTypes​(Class<?> parentClass)
        Registers mock instances for every public static nested class found in parentClass.
        Parameters:
        parentClass - the parentClass to scan for nested public static types
      • registerInstancesForFields

        public static void registerInstancesForFields​(Object instance)
        Registers mocks via Mocks.register(String, Object) for all attributes with Named-types.
        Parameters:
        instance - instance who's fields are registered (maybe Junit test or jbehave steps).
      • registerNewInstancesForNestedTypes

        public static void registerNewInstancesForNestedTypes​(Class<?> parentClass)
        Registers new instances for every public static nested class found in parentClass.
        Parameters:
        parentClass - the parentClass to scan for nested public static types
      • registerMockInstances

        public static void registerMockInstances​(Class<?>... types)
        Creates and registers mock instance for every given type.
        Parameters:
        types - collection of types to mock and register
        See Also:
        registerMockInstances(java.util.Collection)
      • registerMockInstances

        public static void registerMockInstances​(Collection<Class<?>> types)
        Creates and registers mock instance for every given type.
        Parameters:
        types - collection of types to mock and register
      • registerMockInstance

        public static <T> T registerMockInstance​(String name,
                                                 Class<T> type)
        Creates a mock for the given type and registers it.
        Parameters:
        name - the juel name under which the mock is registered
        type - the type of the mock to create
        Returns:
        the registered mock instance
      • registerMockInstance

        public static <T> T registerMockInstance​(Class<T> type)
        Creates a mock for the given type and registers it.
        Parameters:
        type - the type of the mock to create
        Returns:
        the registered mock instance
      • registerNewInstance

        public static <T> T registerNewInstance​(String name,
                                                Class<T> type)
        Creates a new instance for the given type and registers it under the given name.
        Parameters:
        name - the name for the registered instance
        type - the type of the instance to create
        Returns:
        the registered instance
      • registerNewInstance

        public static <T> T registerNewInstance​(Class<T> type)
        Creates a new instance for the given type using the default constructor and registers it.
        Parameters:
        type - the type of the instance to create
        Returns:
        the registered instance
        See Also:
        registerNewInstance(String, Class)
      • registerInstance

        public static <T> T registerInstance​(T instance)
        If you already have the instance, register it directly. Name is guessed via NameForType.
        Parameters:
        instance - the instance or mock to register
        Returns:
        the registered instance
      • registerInstance

        public static <T> T registerInstance​(String name,
                                             T instance)
        Delegates to Mocks.register(String, Object)
        Parameters:
        name - the juel name for the registered instance
        instance - the instance to register
        Returns:
        the registered instance
      • getRegistered

        public static <T> T getRegistered​(String name)
        Parameters:
        name - juel name of the registered instance or mock
        Returns:
        registered instance or mock of type
      • getRegistered

        public static <T> T getRegistered​(Class<?> type)
        Parameters:
        type - the type of the registered instance or mock
        Returns:
        registered instance or mock for type
      • reset

        public static void reset()
        See Also:
        Mocks.reset()
      • mockFilterQuery

        public static FilterQueryMock mockFilterQuery​(org.camunda.bpm.engine.FilterService serviceMock)
      • mockTaskQuery

        public static TaskQueryMock mockTaskQuery​(org.camunda.bpm.engine.TaskService serviceMock)
      • mockCaseInstanceQuery

        public static CaseInstanceQueryMock mockCaseInstanceQuery​(org.camunda.bpm.engine.CaseService serviceMock)
      • mockCaseExecutionQuery

        public static CaseExecutionQueryMock mockCaseExecutionQuery​(org.camunda.bpm.engine.CaseService serviceMock)
      • mockExecutionQuery

        public static ExecutionQueryMock mockExecutionQuery​(org.camunda.bpm.engine.RuntimeService serviceMock)
      • mockProcessInstanceQuery

        public static ProcessInstanceQueryMock mockProcessInstanceQuery​(org.camunda.bpm.engine.RuntimeService serviceMock)
      • mockIncidentQuery

        public static IncidentQueryMock mockIncidentQuery​(org.camunda.bpm.engine.RuntimeService serviceMock)
      • mockEventSubscriptionQuery

        public static EventSubscriptionQueryMock mockEventSubscriptionQuery​(org.camunda.bpm.engine.RuntimeService serviceMock)
      • mockVariableInstanceQuery

        public static VariableInstanceQueryMock mockVariableInstanceQuery​(org.camunda.bpm.engine.RuntimeService serviceMock)
      • mockProcessDefinitionQuery

        public static ProcessDefinitionQueryMock mockProcessDefinitionQuery​(org.camunda.bpm.engine.RepositoryService serviceMock)
      • mockCaseDefinitionQuery

        public static CaseDefinitionQueryMock mockCaseDefinitionQuery​(org.camunda.bpm.engine.RepositoryService serviceMock)
      • mockDecisionDefinitionQuery

        public static DecisionDefinitionQueryMock mockDecisionDefinitionQuery​(org.camunda.bpm.engine.RepositoryService serviceMock)
      • mockDeploymentQuery

        public static DeploymentQueryMock mockDeploymentQuery​(org.camunda.bpm.engine.RepositoryService serviceMock)
      • mockHistoricIdentityLinkLogQuery

        public static HistoricIdentityLinkLogQueryMock mockHistoricIdentityLinkLogQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricProcessInstanceQuery

        public static HistoricProcessInstanceQueryMock mockHistoricProcessInstanceQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricActivityStatisticsQuery

        public static HistoricActivityStatisticsQueryMock mockHistoricActivityStatisticsQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricVariableInstanceQuery

        public static HistoricVariableInstanceQueryMock mockHistoricVariableInstanceQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricCaseActivityInstanceQuery

        public static HistoricCaseActivityInstanceQueryMock mockHistoricCaseActivityInstanceQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricDecisionInstanceQuery

        public static HistoricDecisionInstanceQueryMock mockHistoricDecisionInstanceQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricTaskInstanceQuery

        public static HistoricTaskInstanceQueryMock mockHistoricTaskInstanceQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricDetailQuery

        public static HistoricDetailQueryMock mockHistoricDetailQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockUserOperationLogQuery

        public static UserOperationLogQueryMock mockUserOperationLogQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricIncidentQuery

        public static HistoricIncidentQueryMock mockHistoricIncidentQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricCaseInstanceQuery

        public static HistoricCaseInstanceQueryMock mockHistoricCaseInstanceQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricJobLogQuery

        public static HistoricJobLogQueryMock mockHistoricJobLogQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockHistoricBatchQuery

        public static HistoricBatchQueryMock mockHistoricBatchQuery​(org.camunda.bpm.engine.HistoryService serviceMock)
      • mockUserQuery

        public static UserQueryMock mockUserQuery​(org.camunda.bpm.engine.IdentityService serviceMock)
      • mockGroupQuery

        public static GroupQueryMock mockGroupQuery​(org.camunda.bpm.engine.IdentityService serviceMock)
      • mockTenantQuery

        public static TenantQueryMock mockTenantQuery​(org.camunda.bpm.engine.IdentityService serviceMock)
      • mockJobQuery

        public static JobQueryMock mockJobQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockBatchQuery

        public static BatchQueryMock mockBatchQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockProcessDefinitionStatisticsQuery

        public static ProcessDefinitionStatisticsQueryMock mockProcessDefinitionStatisticsQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockJobDefinitionQuery

        public static JobDefinitionQueryMock mockJobDefinitionQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockDeploymentStatisticsQuery

        public static DeploymentStatisticsQueryMock mockDeploymentStatisticsQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockActivityStatisticsQuery

        public static ActivityStatisticsQueryMock mockActivityStatisticsQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockBatchStatisticsQuery

        public static BatchStatisticsQueryMock mockBatchStatisticsQuery​(org.camunda.bpm.engine.ManagementService serviceMock)
      • mockAuthorizationQuery

        public static AuthorizationQueryMock mockAuthorizationQuery​(org.camunda.bpm.engine.AuthorizationService serviceMock)
      • mockExternalTaskQuery

        public static ExternalTaskQueryMock mockExternalTaskQuery​(org.camunda.bpm.engine.ExternalTaskService serviceMock)
      • candidateUserIds

        public static Set<String> candidateUserIds​(org.camunda.bpm.engine.delegate.DelegateTask task)
      • candidateGroupIds

        public static Set<String> candidateGroupIds​(org.camunda.bpm.engine.delegate.DelegateTask task)
      • registerCallActivityMock

        public static CallActivityMock registerCallActivityMock​(String processDefinitionKey)
      • runtimeServiceFluentMock

        public static RuntimeServiceFluentMock runtimeServiceFluentMock​(org.camunda.bpm.engine.RuntimeService runtimeServiceMock)