@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: + " <count>1</count><first index='0'>28482-98726-73623</first>" + " <last>28482-98726-73623</last></set></fin></iq>"), true, null).build(), responseStanzas.get(1)); }
public List<Stanza> toStanzas() { List<Stanza> stanzas = new ArrayList<>(); archivedMessages.list().stream().map(archivedMessage -> new MatchingArchivedMessageResult(initiatingEntity, archiveId, query, archivedMessage)).map(MatchingArchivedMessageResult::toStanza).forEach(stanzas::add); stanzas.add(buildResultIq()); return stanzas; }
MatchingArchivedMessageResults { public List<Stanza> toStanzas() { List<Stanza> stanzas = new ArrayList<>(); archivedMessages.list().stream().map(archivedMessage -> new MatchingArchivedMessageResult(initiatingEntity, archiveId, query, archivedMessage)).map(MatchingArchivedMessageResult::toStanza).forEach(stanzas::add); stanzas.add(buildResultIq()); return stanzas; } }
MatchingArchivedMessageResults { public List<Stanza> toStanzas() { List<Stanza> stanzas = new ArrayList<>(); archivedMessages.list().stream().map(archivedMessage -> new MatchingArchivedMessageResult(initiatingEntity, archiveId, query, archivedMessage)).map(MatchingArchivedMessageResult::toStanza).forEach(stanzas::add); stanzas.add(buildResultIq()); return stanzas; } MatchingArchivedMessageResults(Entity initiatingEntity, Entity archiveId, Query query,
            ArchivedMessages archivedMessages); }
MatchingArchivedMessageResults { public List<Stanza> toStanzas() { List<Stanza> stanzas = new ArrayList<>(); archivedMessages.list().stream().map(archivedMessage -> new MatchingArchivedMessageResult(initiatingEntity, archiveId, query, archivedMessage)).map(MatchingArchivedMessageResult::toStanza).forEach(stanzas::add); stanzas.add(buildResultIq()); return stanzas; } MatchingArchivedMessageResults(Entity initiatingEntity, Entity archiveId, Query query,
            ArchivedMessages archivedMessages); List<Stanza> toStanzas(); }
MatchingArchivedMessageResults { public List<Stanza> toStanzas() { List<Stanza> stanzas = new ArrayList<>(); archivedMessages.list().stream().map(archivedMessage -> new MatchingArchivedMessageResult(initiatingEntity, archiveId, query, archivedMessage)).map(MatchingArchivedMessageResult::toStanza).forEach(stanzas::add); stanzas.add(buildResultIq()); return stanzas; } MatchingArchivedMessageResults(Entity initiatingEntity, Entity archiveId, Query query,
            ArchivedMessages archivedMessages); List<Stanza> toStanzas();  }