BaseAddEmrStep extends BaseJavaDelegate { protected void populateCommonParams(Object request, DelegateExecution execution) { EmrStepHelper stepHelper = emrStepHelperFactory.getStepHelper(request.getClass().getName()); stepHelper.setRequestStepName(request, getStepName(execution)); stepHelper.setRequestContinueOnError(request, getContinueOnError(execution)); stepHelper.setRequestNamespace(request, getNamespace(execution)); stepHelper.setRequestEmrClusterDefinitionName(request, getEmrClusterDefinitionName(execution)); stepHelper.setRequestEmrClusterName(request, getEmrClusterName(execution)); stepHelper.setRequestEmrClusterId(request, getEmrClusterId(execution)); stepHelper.setRequestAccountId(request, getAccountId(execution)); }   static final String VARIABLE_EMR_STEP_ID; }
@Test public void populateCommonParamsAssertEmrStepHelperPopulatedCorrectly() { Object request = "request"; DelegateExecution execution = mock(DelegateExecution.class); EmrStepHelper emrStepHelper = mock(EmrStepHelper.class); when(emrStepHelperFactory.getStepHelper(any())).thenReturn(emrStepHelper); String namespaceString = "namespaceString"; when(activitiHelper.getExpressionVariableAsString(same(namespace), any())).thenReturn(namespaceString); String stepNameString = "stepNameString"; when(activitiHelper.getExpressionVariableAsString(same(stepName), any())).thenReturn(stepNameString); Boolean continueOnErrorBoolean = false; when(activitiHelper.getExpressionVariableAsBoolean(same(continueOnError), any(), any(), anyBoolean(), any())).thenReturn(continueOnErrorBoolean); String emrClusterDefinitionNameString = "emrClusterDefinitionNameString"; when(activitiHelper.getExpressionVariableAsString(same(emrClusterDefinitionName), any())).thenReturn(emrClusterDefinitionNameString); String emrClusterNameString = "emrClusterNameString"; when(activitiHelper.getExpressionVariableAsString(same(emrClusterName), any())).thenReturn(emrClusterNameString); String emrClusterIdString = "emrClusterIdString"; when(activitiHelper.getExpressionVariableAsString(same(emrClusterId), any())).thenReturn(emrClusterIdString); baseAddEmrStep.populateCommonParams(request, execution); verify(emrStepHelper).setRequestStepName(request, stepNameString); verify(emrStepHelper).setRequestContinueOnError(request, continueOnErrorBoolean); verify(emrStepHelper).setRequestNamespace(request, namespaceString); verify(emrStepHelper).setRequestEmrClusterDefinitionName(request, emrClusterDefinitionNameString); verify(emrStepHelper).setRequestEmrClusterName(request, emrClusterNameString); verify(emrStepHelper).setRequestEmrClusterId(request, emrClusterIdString); }