PropertiesResourcePropertySource extends BasePropertySource { @Override public Map<String, PropertyValue> getProperties() { return cachedProperties.getProperties(); } PropertiesResourcePropertySource(URL url);  PropertiesResourcePropertySource(URL url, String prefix);  PropertiesResourcePropertySource(String path);  PropertiesResourcePropertySource(String path, ClassLoader cl); @Override void addChangeListener(BiConsumer<Set<String>, PropertySource> l); @Override void removeChangeListener(BiConsumer<Set<String>, PropertySource> l); @Override void removeAllChangeListeners(); @Override Map<String, PropertyValue> getProperties(); @Override String getVersion(); @Override ChangeSupport getChangeSupport();  }
@Test public void testBasicConstructor() { PropertiesResourcePropertySource source = new PropertiesResourcePropertySource(resource); assertThat(source).isNotNull(); assertThat(source.getProperties()).hasSize(5).containsKey("key1"); }
@Test public void testPrefixedPathBadClassloaderConstructor() { ClassLoader badLoader = new ClassLoader() { @Override public URL getResource(String name){ return null; } }; PropertiesResourcePropertySource source = new PropertiesResourcePropertySource(testFileName, badLoader); assertThat(source).isNotNull(); assertThat(source.getProperties()).isEmpty(); }