@Test public void testFromSystem() throws Exception { test3Properties.forEach(System::setProperty); assertContains(test3Properties, configurationHelper.fromSystem()); }
@Test public void testFromSystem_containsListValues() throws Exception { AbstractConfiguration.setDefaultListDelimiter('|'); Map<String, String> properties = Maps.newHashMap(); properties.put("testProperty", "b,bee"); properties.forEach(System::setProperty); Splitter splitter = Splitter.on(','); Configuration systemConfiguration = configurationHelper.fromSystem(); for (Entry<String, String> entry : properties.entrySet()) { String[] actualValues = systemConfiguration.getStringArray(entry.getKey()); String[] expectedValues; if ("line.separator".equals(entry.getKey())) { expectedValues = new String[] {SystemUtils.LINE_SEPARATOR}; } else { expectedValues = splitter.splitToList(entry.getValue()).toArray(new String[0]); } assertArrayEquals(String.format("Values for key %s do not match", entry.getKey()), expectedValues, actualValues); } }
addConfiguration(combinedConfiguration, fromSystem());
addConfiguration(combinedConfiguration, fromSystem());