MultiAttributeCollection extends MultiAttributeProvider implements AttributeCollection { @Override public boolean removeAllAttributes() { final boolean b = this.runProviderEvents.getAndSet(false); try { boolean changed = false; for (final AttributeProvider c : containers()) { if (c instanceof AttributeCollection) { changed = ((AttributeCollection) c).removeAllAttributes() || changed; } } if (changed) { this.cache.clear(); this.names = null; fireAttributeChange(new AttributeChangeEvent(this, Type.REMOVE_ALL, null, null, null, null)); } return changed; } finally { this.runProviderEvents.set(b); } }  @Pure @Override synchronized boolean isEventFirable(); @Override synchronized void setEventFirable(boolean isFirable); @Override MultiAttributeCollection clone(); @Override boolean addAttributeContainer(AttributeProvider container); @Override boolean removeAttributeContainer(AttributeProvider container); @Override void addAttributeChangeListener(AttributeChangeListener listener); @Override void removeAttributeChangeListener(AttributeChangeListener listener); @Override void flush(); @Override boolean removeAllAttributes(); @Override boolean removeAttribute(String name); @Override boolean renameAttribute(String oldname, String newname); @Override boolean renameAttribute(String oldname, String newname, boolean overwrite); @Override void addAttributes(AttributeProvider content); @Override void addAttributes(Map<String, Object> content); @Override void setAttributes(AttributeProvider content); @Override void setAttributes(Map<String, Object> content); @Override Attribute setAttribute(String name, AttributeValue value); @Override Attribute setAttribute(String name, boolean value); @Override Attribute setAttribute(String name, int value); @Override Attribute setAttribute(String name, long value); @Override Attribute setAttribute(String name, float value); @Override Attribute setAttribute(String name, double value); @Override Attribute setAttribute(String name, String value); @Override Attribute setAttribute(String name, InetAddress value); @Override Attribute setAttribute(String name, InetSocketAddress value); @Override Attribute setAttribute(String name, Enum<?> value); @Override Attribute setAttribute(String name, Class<?> value); @Override Attribute setAttribute(String name, UUID value); @Override Attribute setAttribute(String name, URL value); @Override Attribute setAttribute(String name, URI value); @Override Attribute setAttribute(String name, Date value); @Override Attribute setAttribute(Attribute value); @Override Attribute setAttributeType(String name, AttributeType type);  }
@Test public void removeAllAttributes() { assertTrue(this.provider.removeAllAttributes()); assertEquals(0, this.subprovider1.getAttributeCount()); assertEquals(0, this.subprovider2.getAttributeCount()); assertEquals(0, this.subprovider3.getAttributeCount()); assertEquals(2, this.subcontainer4.getAttributeCount()); assertEquals(2, this.provider.getAttributeCount()); assertEpsilonEquals(Collections.emptyList(), this.subprovider1.getAllAttributes()); assertEpsilonEquals(Collections.emptyList(), this.subprovider2.getAllAttributes()); assertEpsilonEquals(Collections.emptyList(), this.subprovider3.getAllAttributes()); assertEpsilonEquals(Arrays.asList( new AttributeImpl("A", true), new AttributeImpl("Z4", "Z4") ), this.subcontainer4.getAllAttributes()); assertEpsilonEquals(Arrays.asList( makeUninitialized("A", AttributeType.BOOLEAN), makeUninitialized("Z4", AttributeType.STRING) ), this.provider.getAllAttributes()); assertFalse(this.provider.removeAllAttributes()); assertEpsilonEquals(Collections.emptyList(), this.subprovider1.getAllAttributes()); assertEpsilonEquals(Collections.emptyList(), this.subprovider2.getAllAttributes()); assertEpsilonEquals(Collections.emptyList(), this.subprovider3.getAllAttributes()); assertEpsilonEquals(Arrays.asList( new AttributeImpl("A", true), new AttributeImpl("Z4", "Z4") ), this.subcontainer4.getAllAttributes()); assertEpsilonEquals(Arrays.asList( makeUninitialized("A", AttributeType.BOOLEAN), makeUninitialized("Z4", AttributeType.STRING) ), this.provider.getAllAttributes()); }