RioConfig implements Serializable { @SuppressWarnings("unchecked") public <T extends Object> T get(RioSetting<T> setting) { Object result = settings.get(setting); if (result == null) { result = systemPropertyCache.get(setting); } if (result == null) { String stringRepresentation = System.getProperty(setting.getKey()); if (stringRepresentation != null) { try { T typesafeSystemProperty = setting.convert(stringRepresentation); systemPropertyCache.put((RioSetting<Object>) setting, typesafeSystemProperty); return typesafeSystemProperty; } catch (RioConfigurationException e) { log.trace(e.getMessage(), e); } } } if (result == null) { return setting.getDefaultValue(); } return (T) result; } RioConfig(); @SuppressWarnings("unchecked") T get(RioSetting<T> setting); @SuppressWarnings("unchecked") RioConfig set(RioSetting<T> setting, T value); boolean isSet(RioSetting<T> setting); RioConfig useDefaults();  }
@Test public void testGetWithUnsupportedConversionType() throws Exception { AbstractRioSetting<String> nonConvertableSetting = new AbstractRioSetting<String>(key, "test setting", "default value") { private static final long serialVersionUID = 1L; }; assertThat(config.get(nonConvertableSetting)).isEqualTo("default value"); System.setProperty(key, "system property value"); assertThat(config.get(nonConvertableSetting)).isEqualTo("default value"); }