@Test
public void testComplete() throws IOException, SAXException {

    ArchivedMessage message = new SimpleArchivedMessage("28482-98726-73623",
            ZonedDateTime.of(LocalDateTime.of(2010, 7, 10, 23, 8, 25), ZoneId.of("Z")), messageStanza);
    ArchivedMessages archivedMessages = new SimpleArchivedMessages(Collections.singletonList(message), 0L, 1L);
    MatchingArchivedMessageResults tested = new MatchingArchivedMessageResults(INITIATING_ENTITY, ARCHIVE_ID, query,
            archivedMessages);
    List<Stanza> responseStanzas = tested.toStanzas();
    assertEquals(2, responseStanzas.size());
    StanzaAssert.assertEquals(StanzaBuilder
            .createClone(XMLParserUtil.parseRequiredDocument("<message to='juliet@capulet.lit/chamber'>"
                    + "  <result xmlns='urn:xmpp:mam:2' queryid='f27' id='28482-98726-73623'>"
                    + "    <forwarded xmlns='urn:xmpp:forward:0'>"
                    + "      <delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
                    + "      <message xmlns='jabber:client' from='witch@shakespeare.lit' to='macbeth@shakespeare.lit'>"
                    + "        <body>Hail to thee</body>"
                    + "        <stanza-id xmlns='urn:xmpp:sid:0' by='juliet@capulet.lit' id='28482-98726-73623'/>"
                    + "</message></forwarded></result></message>"), true, null)
            .build(), responseStanzas.get(0));
    StanzaAssert.assertEquals(
            StanzaBuilder.createClone(XMLParserUtil.parseRequiredDocument(
                    "<iq type='result' id='juliet1'><fin xmlns='urn:xmpp:mam:2' complete='true'>"
                            + "    <set xmlns='http://jabber.org/protocol/rsm'>"
                            + "      <count>1</count><first index='0'>28482-98726-73623</first>"
                            + "      <last>28482-98726-73623</last></set></fin></iq>"),
                    true, null).build(),
            responseStanzas.get(1));
}