### Question:
AttributeContainerMutable implements AttributeContainer { public AttributeContainer toImmutable() { return new AttributeContainerImmutable(name, atts); } AttributeContainerMutable(@Nullable String name);  AttributeContainerMutable(@Nullable String name, Iterable<Attribute> from); static AttributeContainerMutable copyFrom(@Nullable AttributeContainer from); void setName(@Nullable String name); @Override @Nullable String getName(); @Override Iterator<Attribute> iterator(); Attribute addAttribute(Attribute att); Attribute addAttribute(String name, String value); Attribute addAttribute(String name, Number value); void addAll(Iterable<Attribute> atts); @Override String findAttributeString(String attName, String defaultValue); @Override Attribute findAttribute(String name); @Override Attribute findAttributeIgnoreCase(String name); @Override double findAttributeDouble(String attName, double defaultValue); @Override int findAttributeInteger(String attName, int defaultValue); boolean remove(Attribute a); boolean replace(Attribute a, String newName); AttributeContainerMutable clear(); boolean removeAttribute(String attName); boolean removeAttributeIgnoreCase(String attName); AttributeContainer toImmutable(); @Override boolean isEmpty();  }### Answer:
@Test public void testToImmutable() { AttributeContainerMutable attc = new AttributeContainerMutable("container"); assertThat(attc.isEmpty()).isTrue(); attc.addAttribute(new Attribute("name", "value")); attc.addAttribute(new Attribute("name2", "value2")); attc.addAttribute("name3", 123); assertThat(Iterables.size(attc)).isEqualTo(3); AttributeContainer imm = attc.toImmutable(); assertThat(!(imm instanceof AttributeContainerMutable)).isTrue(); assertThat(imm.isEmpty()).isFalse(); assertThat(Iterables.size(imm)).isEqualTo(3); assertThat(imm.getName()).isEqualTo("container"); assertThat(imm.findAttributeIgnoreCase("NAME")).isNotNull(); assertThat(imm.findAttributeString("NAME", null)).isEqualTo("value"); assertThat(imm.findAttributeInteger("NAME3", -1)).isEqualTo(123); assertThat(imm.findAttributeDouble("NAME3", Double.NaN)).isEqualTo(123.0); AttributeContainerMutable attcc = new AttributeContainerMutable("cc", imm); assertThat(Iterables.size(attcc)).isEqualTo(3); assertThat(attcc.getName()).isEqualTo("cc"); }