/** Ensure able to initialise with <code>null</code> value. */ public void testInitialiseWithNullValue() { this.properties.addProperty("blank", null); // Initialise from properties SourcePropertiesImpl clone = new SourcePropertiesImpl(this.properties); // Ensure null value loaded Properties props = clone.getProperties(); assertTrue("Ensure load null value", props.keySet().contains("blank")); }
/** Initialises from properties. */ public void testInitialiseFromProperties() { this.properties.addProperty("one", "1"); this.properties.addProperty("two", "2"); this.properties.addProperty("three", "3"); this.properties.addProperty("four", "4"); // Initialise from properties SourcePropertiesImpl clone = new SourcePropertiesImpl(this.properties); // Ensure copied in the properties (in same order) String[] names = clone.getPropertyNames(); assertEquals("Incorrect number of property names", 4, names.length); assertEquals("Name one", "one", names[0]); assertEquals("Name two", "two", names[1]); assertEquals("Name three", "three", names[2]); assertEquals("Name four", "four", names[3]); // Ensure values as expected assertEquals("Incorrect one", "1", clone.getProperty("one")); assertEquals("Incorrect two", "2", clone.getProperty("two")); assertEquals("Incorrect three", "3", clone.getProperty("three")); assertEquals("Incorrect four", "4", clone.getProperty("four")); }