@Test public void testEmptyPage() throws IOException, SAXException { SimpleArchivedMessages archivedMessages = new SimpleArchivedMessages(Collections.emptyList(), 0L, 50L); MatchingArchivedMessageResults tested = new MatchingArchivedMessageResults(INITIATING_ENTITY, ARCHIVE_ID, query, archivedMessages); List<Stanza> responseStanzas = tested.toStanzas(); assertEquals(1, responseStanzas.size()); StanzaAssert.assertEquals( StanzaBuilder.createClone(XMLParserUtil .parseRequiredDocument("<iq type='result' id='juliet1'><fin xmlns='urn:xmpp:mam:2'>" + " <set xmlns='http: + " <count>50</count></set></fin></iq>"), true, null).build(), responseStanzas.get(0)); }
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();  }