### Question:
AttachmentListMetadataSerializer extends AbstractXMLSerializer<List<XWikiAttachment>, List<XWikiAttachment>> { @Override public List<XWikiAttachment> parse(final Element docel) throws IOException { if (!ROOT_ELEMENT_NAME.equals(docel.getName())) { throw new IOException("XML not recognizable as archive metadata, expecting <archive> tag"); } if (!THIS_SERIALIZER.equals(docel.attribute(SERIALIZER_PARAM).getValue())) { throw new IOException("Cannot parse this attachment archive metadata, it was saved with a " + "different serializer."); } final List<XWikiAttachment> attachments = new ArrayList<XWikiAttachment>(docel.elements().size()); for (Element attach : ((List<Element>) docel.elements())) { attachments.add(this.attachSerializer.parse(attach)); } return attachments; } AttachmentListMetadataSerializer();  AttachmentListMetadataSerializer(
        final XMLSerializer<XWikiAttachment, XWikiAttachment> attachSerializer); @Override List<XWikiAttachment> parse(final Element docel); @Override void serialize(final List<XWikiAttachment> attachments,
        final XMLWriter writer);  }### Answer:
@Test public void testParse() throws Exception { final ByteArrayInputStream bais = new ByteArrayInputStream(TEST_CONTENT.getBytes("US-ASCII")); final List<XWikiAttachment> attachList = this.serializer.parse(bais); bais.close(); Assert.assertTrue("Attachment list was wrong size", 3 == attachList.size()); Assert.assertEquals("Attachment1 had wrong name", "file1", attachList.get(0).getFilename()); Assert.assertEquals("Attachment2 had wrong name", "file1", attachList.get(1).getFilename()); Assert.assertEquals("Attachment3 had wrong name", "file1", attachList.get(2).getFilename()); Assert.assertEquals("Attachment1 had wrong author", "me", attachList.get(0).getAuthor()); Assert.assertEquals("Attachment2 had wrong author", "you", attachList.get(1).getAuthor()); Assert.assertEquals("Attachment3 had wrong author", "them", attachList.get(2).getAuthor()); Assert.assertEquals("Attachment1 had wrong version", "1.1", attachList.get(0).getVersion()); Assert.assertEquals("Attachment2 had wrong version", "1.2", attachList.get(1).getVersion()); Assert.assertEquals("Attachment3 had wrong version", "1.3", attachList.get(2).getVersion()); Assert.assertEquals("Attachment1 had wrong comment", attachList.get(0).getComment(), "something whitty"); Assert.assertEquals("Attachment2 had wrong comment", "a comment", attachList.get(1).getComment()); Assert.assertEquals("Attachment3 had wrong comment", "i saved it", attachList.get(2).getComment()); Assert.assertEquals("Attachment1 had wrong date.", attachList.get(0).getDate().getTime() + "", "1293045632000"); Assert.assertEquals("Attachment2 had wrong date.", attachList.get(1).getDate().getTime() + "", "1293789456000"); Assert.assertEquals("Attachment3 had wrong date.", attachList.get(2).getDate().getTime() + "", "1293012345000"); }