void testVariableAccessing()

in ddm-bpm-data-accessor/src/it/java/com/epam/digital/data/platform/dataaccessor/annotation/SystemVariableBeanPostProcessorIT.java [65:94]


  void testVariableAccessing() {
    when(delegateExecution.getVariable(VALID_VARIABLE_NAME)).thenReturn(VARIABLE_VALUE);
    assertThat(validVariable.from(delegateExecution).get()).isEqualTo(VARIABLE_VALUE);

    clearInvocations(delegateExecution);
    when(delegateExecution.getVariable(VALID_TRANSIENT_VARIABLE_NAME)).thenReturn(VARIABLE_VALUE);
    assertThat(validTransientVariable.from(delegateExecution).get()).isEqualTo(VARIABLE_VALUE);

    clearInvocations(delegateExecution);
    validVariable.on(delegateExecution).set(VARIABLE_VALUE);
    verify(delegateExecution).setVariable(VALID_VARIABLE_NAME, VARIABLE_VALUE);

    clearInvocations(delegateExecution);
    validTransientVariable.on(delegateExecution).set(VARIABLE_VALUE);
    verify(delegateExecution).setVariableLocal(VALID_TRANSIENT_VARIABLE_NAME,
        Variables.untypedValue(VARIABLE_VALUE, true));

    clearInvocations(delegateExecution);
    validVariable.on(delegateExecution).setLocal(VARIABLE_VALUE);
    verify(delegateExecution).setVariableLocal(VALID_VARIABLE_NAME, VARIABLE_VALUE);

    clearInvocations(delegateExecution);
    validTransientVariable.on(delegateExecution).setLocal(VARIABLE_VALUE);
    verify(delegateExecution).setVariableLocal(VALID_TRANSIENT_VARIABLE_NAME,
        Variables.untypedValue(VARIABLE_VALUE, true));

    clearInvocations(delegateExecution);
    validTransientVariable.on(delegateExecution).remove();
    verify(delegateExecution).removeVariable(VALID_TRANSIENT_VARIABLE_NAME);
  }