ConfigItemMapEntrySingleton implements ConfigItemMapEntry { public String set(final String name, final String value) { final ConfigBlock block = this.getByName(name); if (block instanceof ConfigItem) { final ConfigItem item = (ConfigItem) block; final String previousValue = item.getValue(); item.setValue(value); return previousValue; } return null; } ConfigItemMapEntrySingleton(final String name, final ConfigBlock block); static ConfigItemMapEntrySingleton createSingleton(final String name,
                                                              final ConfigBlock configBlock); static ConfigItemMapEntrySingleton createSingleton(final ConfigBlock configBlock); @Override String getName(); @Override int size(); @Override boolean isEmpty(); @Override boolean add(final ConfigBlock block); @Override ConfigBlock put(final ConfigBlock block); boolean contains(final String name); @Override void appendXMLContent(final XMLUtil util, final Appendable appendable); @Override Iterator<ConfigBlock> iterator(); @Override boolean add(final String name, final String type, final String value); ConfigBlock getByName(final String name); String set(final String name, final String value); String set(final String value);  }
@Test public void testSet() { Assert.assertEquals("v", this.singleton.set("value")); Assert.assertNull(this.singleton.set("name", "value")); }
@Test public void testSet2() { Assert.assertEquals("v", this.singleton.set("value")); Assert.assertEquals("value", this.singleton.set("n", "value2")); }