### Question:
MqEnvProp implements EnvironmentAware { public Map<String, Object> getEnv() { Map<String, Object> result = new LinkedHashMap<String, Object>(); for (Entry<String, PropertySource<?>> entry : getPropertySources().entrySet()) { PropertySource<?> source = entry.getValue(); if (source instanceof EnumerablePropertySource) { EnumerablePropertySource<?> enumerable = (EnumerablePropertySource<?>) source; for (String name : enumerable.getPropertyNames()) { if(!result.containsKey(name)){ result.put(name, sanitize(name, enumerable.getProperty(name))); } } } } return result; }  Map<String, Map<String, Object>> getAllEnv(); Map<String, Object> getEnv(); Map<String, Object> getEnv(String prefix); Object sanitize(String name, Object object); @Override void setEnvironment(Environment environment);  }### Answer:
@Test public void getEnvTest() { ConfigurableEnvironment environment=mock(ConfigurableEnvironment.class); MutablePropertySources mutablePropertySources=new MutablePropertySources(); when(environment.getPropertySources()).thenReturn(mutablePropertySources); Map<String, Object> map=new HashMap<String, Object>(); map.put("test.test2", "fa"); map.put("test.password", "dfasf"); environment.getPropertySources().addFirst(new MapPropertySource("test", map)); MqEnvProp mqEnvProp=new MqEnvProp(); mqEnvProp.setEnvironment(environment); assertEquals(2, mqEnvProp.getEnv("test").size()); }