EmrDaoImpl implements EmrDao { protected List<EbsBlockDeviceConfig> getEbsBlockDeviceConfigs(List<EmrClusterDefinitionEbsBlockDeviceConfig> emrClusterDefinitionEbsBlockDeviceConfigs) { List<EbsBlockDeviceConfig> ebsBlockDeviceConfigs = null; if (!CollectionUtils.isEmpty(emrClusterDefinitionEbsBlockDeviceConfigs)) { ebsBlockDeviceConfigs = new ArrayList<>(); for (EmrClusterDefinitionEbsBlockDeviceConfig emrClusterDefinitionEbsBlockDeviceConfig : emrClusterDefinitionEbsBlockDeviceConfigs) { if (emrClusterDefinitionEbsBlockDeviceConfig != null) { EbsBlockDeviceConfig ebsBlockDeviceConfig = new EbsBlockDeviceConfig(); ebsBlockDeviceConfig.setVolumeSpecification(getVolumeSpecification(emrClusterDefinitionEbsBlockDeviceConfig.getVolumeSpecification())); ebsBlockDeviceConfig.setVolumesPerInstance(emrClusterDefinitionEbsBlockDeviceConfig.getVolumesPerInstance()); ebsBlockDeviceConfigs.add(ebsBlockDeviceConfig); } } } return ebsBlockDeviceConfigs; }  @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 testGetEbsBlockDeviceConfigs() { List<EbsBlockDeviceConfig> result = emrDaoImpl.getEbsBlockDeviceConfigs(Collections.singletonList( new EmrClusterDefinitionEbsBlockDeviceConfig(new EmrClusterDefinitionVolumeSpecification(VOLUME_TYPE, IOPS, SIZE_IN_GB), VOLUMES_PER_INSTANCE))); verifyNoMoreInteractionsHelper(); assertEquals(Collections.singletonList( new EbsBlockDeviceConfig().withVolumeSpecification(new VolumeSpecification().withVolumeType(VOLUME_TYPE).withIops(IOPS).withSizeInGB(SIZE_IN_GB)) .withVolumesPerInstance(VOLUMES_PER_INSTANCE)), result); }
@Test public void testGetEbsBlockDeviceConfigsWhenInputListContainsNullElement() { List<EmrClusterDefinitionEbsBlockDeviceConfig> emrClusterDefinitionEbsBlockDeviceConfigs = new ArrayList<>(); emrClusterDefinitionEbsBlockDeviceConfigs.add(null); List<EbsBlockDeviceConfig> result = emrDaoImpl.getEbsBlockDeviceConfigs(emrClusterDefinitionEbsBlockDeviceConfigs); verifyNoMoreInteractionsHelper(); assertEquals(new ArrayList<>(), result); }
@Test public void testGetEbsBlockDeviceConfigsWhenInputListIsEmpty() { List<EbsBlockDeviceConfig> result = emrDaoImpl.getEbsBlockDeviceConfigs(new ArrayList<>()); verifyNoMoreInteractionsHelper(); assertNull(result); }