EmrDaoImpl implements EmrDao { protected SpotProvisioningSpecification getSpotSpecification(EmrClusterDefinitionSpotSpecification emrClusterDefinitionSpotSpecification) { SpotProvisioningSpecification spotProvisioningSpecification = null; if (emrClusterDefinitionSpotSpecification != null) { spotProvisioningSpecification = new SpotProvisioningSpecification(); spotProvisioningSpecification.setTimeoutDurationMinutes(emrClusterDefinitionSpotSpecification.getTimeoutDurationMinutes()); spotProvisioningSpecification.setTimeoutAction(emrClusterDefinitionSpotSpecification.getTimeoutAction()); spotProvisioningSpecification.setBlockDurationMinutes(emrClusterDefinitionSpotSpecification.getBlockDurationMinutes()); spotProvisioningSpecification.setAllocationStrategy(emrClusterDefinitionSpotSpecification.getAllocationStrategy()); } return spotProvisioningSpecification; }  @Override String addEmrStep(String clusterId, StepConfig emrStepConfig, AwsParamsDto awsParamsDto); @Override String createEmrCluster(String clusterName, EmrClusterDefinition emrClusterDefinition, EmrParamsDto emrParamsDto); @Override synchronized ClusterSummary getActiveEmrClusterByNameAndAccountId(String clusterName, String accountId, AwsParamsDto awsParams); List<Application> getApplications(List<EmrClusterDefinitionApplication> emrClusterDefinitionApplications); @Override StepSummary getClusterActiveStep(String clusterId, AwsParamsDto awsParamsDto); @Override Step getClusterStep(String clusterId, String stepId, AwsParamsDto awsParamsDto); @Override AmazonElasticMapReduceClient getEmrClient(AwsParamsDto awsParamsDto); @Override Cluster getEmrClusterById(String clusterId, AwsParamsDto awsParams); @Override String getEmrClusterStatusById(String clusterId, AwsParamsDto awsParams); @Override Instance getEmrMasterInstance(String clusterId, AwsParamsDto awsParams); @Override ListInstanceFleetsResult getListInstanceFleetsResult(String clusterId, AwsParamsDto awsParams); @Override void terminateEmrCluster(String clusterId, boolean overrideTerminationProtection, AwsParamsDto awsParams);  }
@Test public void testGetSpotSpecification() { final EmrClusterDefinitionSpotSpecification emrClusterDefinitionSpotSpecification = new EmrClusterDefinitionSpotSpecification(TIMEOUT_DURATION_MINUTES, TIMEOUT_ACTION, BLOCK_DURATION_MINUTES, ALLOCATION_STRATEGY_1); SpotProvisioningSpecification result = emrDaoImpl.getSpotSpecification(emrClusterDefinitionSpotSpecification); verifyNoMoreInteractionsHelper(); assertEquals(new SpotProvisioningSpecification().withTimeoutDurationMinutes(TIMEOUT_DURATION_MINUTES).withTimeoutAction(TIMEOUT_ACTION) .withBlockDurationMinutes(BLOCK_DURATION_MINUTES).withAllocationStrategy(ALLOCATION_STRATEGY_1), result); }
@Test public void testGetSpotSpecificationWhenEmrClusterDefinitionSpotSpecificationIsNull() { SpotProvisioningSpecification result = emrDaoImpl.getSpotSpecification(null); verifyNoMoreInteractionsHelper(); assertNull(result); }