@Test
public void testAddPigStepToEmrCluster() throws Exception
{

    // Create an add step request.
    EmrPigStepAddRequest emrPigStepAddRequest =
        new EmrPigStepAddRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, EMR_CLUSTER_NAME, EMR_STEP_NAME, EMR_STEP_SCRIPT_LOCATION,
            Arrays.asList(ATTRIBUTE_NAME_1_MIXED_CASE), CONTINUE_ON_ERROR, EMR_CLUSTER_ID, AWS_ACCOUNT_ID);
    // Create an add step response.
    EmrPigStep emrPigStep = new EmrPigStep(EMR_STEP_ID, NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, EMR_CLUSTER_NAME, EMR_STEP_NAME, EMR_STEP_SCRIPT_LOCATION,
        Arrays.asList(ATTRIBUTE_NAME_1_MIXED_CASE), CONTINUE_ON_ERROR, EMR_CLUSTER_ID);
    // Mock the external calls.
    when(emrService.addStepToCluster(emrPigStepAddRequest)).thenReturn(emrPigStep);
    // Call the method under test.
    EmrPigStep result = emrRestController.addPigStepToEmrCluster(emrPigStepAddRequest);
    // Verify the external calls.
    verify(emrService).addStepToCluster(emrPigStepAddRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(emrPigStep, result);
}