### Question:
MsoYamlEditorWithEnvt { public synchronized Set<MsoHeatEnvironmentResource> getResourceListFromEnvt() { try { Set<MsoHeatEnvironmentResource> resourceList = new HashSet<>(); @SuppressWarnings("unchecked") Map<String, Object> resourceMap = (Map<String, Object>) yml.get("resource_registry"); for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) { MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource(); Entry<String, Object> pair = stringObjectEntry; her.setName((String) pair.getKey()); her.setValue((String) pair.getValue()); resourceList.add(her); } return resourceList; } catch (Exception e) { logger.debug(EXCEPTION, e); } return null; } MsoYamlEditorWithEnvt();  MsoYamlEditorWithEnvt(byte[] b); @SuppressWarnings("unchecked") synchronized Set<MsoHeatEnvironmentParameter> getParameterListFromEnvt(); synchronized Set<MsoHeatEnvironmentResource> getResourceListFromEnvt(); synchronized Set<HeatTemplateParam> getParameterList(); static final String EXCEPTION; }### Answer:
@Test public void getResourceListFromEnvtTest() { yaml = new MsoYamlEditorWithEnvt(RAW_ENTRY_WITH_RESOURCE_REGISTRY.getBytes()); MsoHeatEnvironmentResource expectedHeatResource = new MsoHeatEnvironmentResource(RESOURCE_NAME, RESOURCE_VALUE); Set<MsoHeatEnvironmentResource> heatResourceSet = yaml.getResourceListFromEnvt(); for (MsoHeatEnvironmentResource heatResource : heatResourceSet) { assertThat(heatResource, sameBeanAs(expectedHeatResource)); } }
@Test public void getResourceListFromEnvtExceptionTest() { yaml = new MsoYamlEditorWithEnvt(); Set<MsoHeatEnvironmentResource> heatResourceSet = yaml.getResourceListFromEnvt(); assertNull(heatResourceSet); }