### Question:
DatasourceConfigSource extends EnabledConfigSource { @Override public String getValue(String propertyName) { if (CONFIG_ORDINAL.equals(propertyName)) { return null; } initRepository(); initValidity(); TimedEntry entry = cache.get(propertyName); if (entry == null){ return readFromDB(propertyName); }else if(entry.isExpired()) { ChangeEventNotifier changeEventNotifier = ChangeEventNotifier.getInstance(); String oldValue = entry.getValue(); String newValue = readFromDB(propertyName); if(notifyOnChanges){ if(newValue==null){ changeEventNotifier.fire(new ChangeEvent(Type.REMOVE,propertyName,changeEventNotifier.getOptionalOldValue(oldValue),null,NAME)); }else if(!oldValue.equals(newValue)){ changeEventNotifier.fire(new ChangeEvent(Type.UPDATE,propertyName,changeEventNotifier.getOptionalOldValue(oldValue),newValue,NAME)); } } return newValue; }else{ return entry.getValue(); } } DatasourceConfigSource(); @Override Map<String, String> getPropertiesIfEnabled(); @Override String getValue(String propertyName); @Override String getName();  }### Answer:
@Test public void testGetProperties_null() { when(configSource.repository.getConfigValue(anyString())).thenReturn(null); configSource.getValue("test"); assertTrue(configSource.getProperties().isEmpty()); }
@Test public void testGetProperties_one() { when(configSource.repository.getAllConfigValues()).thenReturn(Collections.singletonMap("test", "value")); configSource.getValue("test"); assertEquals(1, configSource.getProperties().size()); }
@Test public void testGetValue() { when(configSource.repository.getConfigValue(anyString())).thenReturn("123"); assertEquals("123", configSource.getValue("test")); }
@Test public void testGetValue_cache() { when(configSource.repository.getConfigValue(anyString())).thenReturn("123"); configSource.getValue("test"); configSource.getValue("test"); verify(configSource.repository, times(1)).getConfigValue(anyString()); }