use of org.jivesoftware.smackx.mam.provider.MamResultProvider in project Smack by igniterealtime.
the class MamResultProviderTest method checkMamResultProvider.
@Test
public void checkMamResultProvider() throws Exception {
XmlPullParser parser = PacketParserUtils.getParserFor(exampleMamResultXml);
MamResultExtension mamResultExtension = new MamResultProvider().parse(parser);
Assert.assertEquals(mamResultExtension.getQueryId(), "f27");
Assert.assertEquals(mamResultExtension.getId(), "28482-98726-73623");
GregorianCalendar calendar = new GregorianCalendar(2010, 7 - 1, 10, 23, 8, 25);
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = calendar.getTime();
Forwarded forwarded = mamResultExtension.getForwarded();
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
Message message = (Message) forwarded.getForwardedStanza();
Assert.assertEquals(message.getFrom(), "romeo@montague.lit/orchard");
Assert.assertEquals(message.getTo(), "juliet@capulet.lit/balcony");
Assert.assertEquals(message.getBody(), "Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.");
}
Aggregations