### Question:
DefaultRuntimeProperties implements RuntimeProperties { @Override public String get(String key) { String property = System.getProperty(key); if (property != null) { return property; } return properties.get(key); } DefaultRuntimeProperties(@Inject(Constants.PROPERTIES_MAP) Map<String, String> properties); @Override String get(String key); @Override String get(String key, String defaultValue); @Override long getLong(String key, long defaultValue); @Override int getInt(String key, int defaultValue); @Override boolean getBoolean(String key, boolean defaultValue);  }### Answer:
@Test public void testGet_FromMap() { Map<String, String> propertiesMap = new HashMap<>(); propertiesMap.put("key1", "v1"); DefaultRuntimeProperties properties = new DefaultRuntimeProperties(propertiesMap); assertEquals("v1", properties.get("key1")); assertNull(properties.get("key2")); }
@Test public void testGet_FromSystem() { String userDir = System.getProperty("user.dir"); assertNotNull(userDir); Map<String, String> propertiesMap = new HashMap<>(); DefaultRuntimeProperties properties = new DefaultRuntimeProperties(propertiesMap); assertEquals(userDir, properties.get("user.dir")); }
@Test public void testGet_FromSystemOverridesMap() { String userDir = System.getProperty("user.dir"); assertNotNull(userDir); Map<String, String> propertiesMap = new HashMap<>(); propertiesMap.put("user.dir", userDir + "_altered"); DefaultRuntimeProperties properties = new DefaultRuntimeProperties(propertiesMap); assertEquals(userDir, properties.get("user.dir")); }