ProcessInitiatorELResolver implements VariableScopeItemELResolver { @Override public Object resolve(String property, VariableScope variableScope) { ExecutionEntity processInstance = ((ExecutionEntity) variableScope).getProcessInstance(); return processInstance != null ? processInstance.getStartUserId() : null; }  @Override boolean canResolve(String property, VariableScope variableScope); @Override Object resolve(String property, VariableScope variableScope);  }
@Test public void resolve_should_returnProcessInitiator() { ExecutionEntity processInstance = mock(ExecutionEntity.class); given(processInstance.getStartUserId()).willReturn("peter"); ExecutionEntity variableScope = buildVariableScope(processInstance); Object result = resolver.resolve(INITIATOR, variableScope); assertThat(result).isEqualTo("peter"); }
@Test public void resolve_should_returnNullWhenVariableScopeDontHaveProcessInstance() { ExecutionEntity variableScope = buildVariableScope(null); Object result = resolver.resolve(INITIATOR, variableScope); assertThat(result).isNull(); }