EmrDaoImpl implements EmrDao { protected Map<String, String> getMap(List<Parameter> parameters) { Map<String, String> map = null; if (!CollectionUtils.isEmpty(parameters)) { map = new HashMap<>(); for (Parameter parameter : parameters) { if (parameter != null) { map.put(parameter.getName(), parameter.getValue()); } } } return map; }  @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 testGetMap() { final String name = STRING_VALUE; final String value = STRING_VALUE_2; final Parameter parameter = new Parameter(name, value); Map<String, String> result = emrDaoImpl.getMap(Lists.newArrayList(parameter)); verifyNoMoreInteractionsHelper(); assertEquals(1, CollectionUtils.size(result)); assertTrue(result.containsKey(name)); assertEquals(value, result.get(name)); }
@Test public void testGetMapWhenInputListContainsNullElement() { List<Parameter> parameters = new ArrayList<>(); parameters.add(null); Map<String, String> result = emrDaoImpl.getMap(parameters); verifyNoMoreInteractionsHelper(); assertNotNull(result); assertEquals(0, result.size()); }