PropertiesBuilder { public Properties realize(PropertiesBuilder overrides) { return realize(overrides, null); } PropertiesBuilder();  PropertiesBuilder(Map<String, String> properties);  PropertiesBuilder(Properties properties);  PropertiesBuilder(PropertiesBuilder propertiesBuilder); int size(); PropertiesBuilder setProperty(String      name,
                                         Iterator<?> iterator); PropertiesBuilder setPropertyIfAbsent(String      name,
                                                 Iterator<?> iterator); PropertiesBuilder setProperty(String name,
                                         Object value); PropertiesBuilder setPropertyIfAbsent(String name,
                                                 Object value); PropertiesBuilder setProperties(PropertiesBuilder propertiesBuilder); PropertiesBuilder addProperties(PropertiesBuilder propertiesBuilder); boolean containsProperty(String name); Object getProperty(String name); void removeProperty(String name); void clear(); Iterable<String> getPropertyNames(); Properties realize(PropertiesBuilder overrides); Properties realize(PropertiesBuilder overrides,
                              Platform          platform); Properties realize(); static PropertiesBuilder fromPropertiesFile(String fileName); static PropertiesBuilder fromCurrentEnvironmentVariables(); static PropertiesBuilder fromCurrentNonStandardSystemProperties(); static final HashSet<String> STANDARD_SYSTEM_PROPERTIES; }
@Test public void shouldUseMapOfValuesFromConstructor() { Map<String, String> values = new HashMap<String, String>(); values.put("Key-1", "Value-1"); values.put("Key-2", "Value-2"); Properties expected = new Properties(); expected.putAll(values); PropertiesBuilder builder = new PropertiesBuilder(values); Properties properties = builder.realize(); assertThat(properties, is(expected)); }
@Test public void shouldCopySystemProperties() { Properties expected = new Properties(); expected.putAll(System.getProperties()); PropertiesBuilder builder = new PropertiesBuilder(System.getProperties()); Properties properties = builder.realize(); assertThat(properties, is(expected)); }