Search in sources :

Example 6 with DefaultConditionDefinition

use of io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition in project kogito-runtimes by kiegroup.

the class SwitchValidatorTest method validateDefaultConditionWithoutTransitionAndEndIsNullError.

@Test
void validateDefaultConditionWithoutTransitionAndEndIsNullError() {
    DefaultConditionDefinition defaultCondition = mock(DefaultConditionDefinition.class);
    Assertions.assertThatThrownBy(() -> SwitchValidator.validateDefaultCondition(defaultCondition, switchState, workflow, parserContext)).isInstanceOf(IllegalArgumentException.class).hasMessage(String.format(TRANSITION_OR_END_MUST_BE_CONFIGURED_FOR_DEFAULT_CONDITION_ERROR, SWITCH_STATE_NAME, WORKFLOW_NAME));
}
Also used : DefaultConditionDefinition(io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition) Test(org.junit.jupiter.api.Test)

Example 7 with DefaultConditionDefinition

use of io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition in project kogito-runtimes by kiegroup.

the class SwitchValidatorTest method validateDefaultConditionWithEventConditionsEndButTimeoutNotSetError.

@Test
void validateDefaultConditionWithEventConditionsEndButTimeoutNotSetError() {
    switchState.getEventConditions().add(mock(EventCondition.class));
    DefaultConditionDefinition defaultCondition = mock(DefaultConditionDefinition.class);
    End end = mock(End.class);
    doReturn(end).when(defaultCondition).getEnd();
    Assertions.assertThatThrownBy(() -> SwitchValidator.validateDefaultCondition(defaultCondition, switchState, workflow, parserContext)).isInstanceOf(IllegalArgumentException.class).hasMessage(String.format(EVENT_TIMEOUT_REQUIRED_ERROR, SWITCH_STATE_NAME, WORKFLOW_NAME));
}
Also used : End(io.serverlessworkflow.api.end.End) EventCondition(io.serverlessworkflow.api.switchconditions.EventCondition) DefaultConditionDefinition(io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition) Test(org.junit.jupiter.api.Test)

Example 8 with DefaultConditionDefinition

use of io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition in project kogito-runtimes by kiegroup.

the class SwitchValidatorTest method mockDefaultConditionWithTransition.

private static DefaultConditionDefinition mockDefaultConditionWithTransition() {
    DefaultConditionDefinition defaultCondition = mock(DefaultConditionDefinition.class);
    Transition transition = mock(Transition.class);
    doReturn(transition).when(defaultCondition).getTransition();
    return defaultCondition;
}
Also used : Transition(io.serverlessworkflow.api.transitions.Transition) DefaultConditionDefinition(io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition)

Aggregations

DefaultConditionDefinition (io.serverlessworkflow.api.defaultdef.DefaultConditionDefinition)8 Transition (io.serverlessworkflow.api.transitions.Transition)5 Test (org.junit.jupiter.api.Test)5 EventCondition (io.serverlessworkflow.api.switchconditions.EventCondition)3 End (io.serverlessworkflow.api.end.End)1 DataCondition (io.serverlessworkflow.api.switchconditions.DataCondition)1