ConfigItemMapEntrySet implements ConfigItemMapEntry { @Override public boolean add(final ConfigBlock block) { final String name = block.getName(); if (this.blockByName.containsKey(name)) { return false; } this.blockByName.put(name, block); return true; } ConfigItemMapEntrySet(final Set<ConfigBlock> blocks);   ConfigItemMapEntrySet(final String name, final Set<ConfigBlock> blocks); static ConfigItemMapEntrySet createSet(); static ConfigItemMapEntrySet createSet(final String name); @Override String getName(); @Override int size(); @Override boolean isEmpty(); boolean contains(final String name); @Override boolean add(final ConfigBlock block); @Override ConfigBlock put(final ConfigBlock block); void remove(final Object o); @Override void appendXMLContent(final XMLUtil util, final Appendable appendable); @Override Iterator<ConfigBlock> iterator(); ConfigBlock getByName(final String name); String set(final String name, final String value); @Override boolean add(final String name, final String type, final String value);  }
@Test public void testAdd() { this.set.add(this.block); Assert.assertEquals(1, this.set.size()); Assert.assertFalse(this.set.isEmpty()); Assert.assertEquals("seq", this.set.getName()); final Iterator<ConfigBlock> it = this.set.iterator(); Assert.assertTrue(it.hasNext()); Assert.assertEquals(this.block, it.next()); Assert.assertFalse(it.hasNext()); }
@Test public void testAppendXML() throws Exception { this.set.add(this.item); TestHelper.assertXMLEquals( "<config:config-item-map-entry config:name=\"seq\">" + this.itemXML + "</config:config-item-map-entry>", this.set); }
@Test public void testAddItemTwice() { Assert.assertTrue(this.set.add("name", "type", "value")); Assert.assertFalse(this.set.add("name", "type", "value")); }