Iterator messages = offlineManager.getMessages();
assertTrue("No message was found", messages.hasNext());
List<String> stamps = new ArrayList<String>();
while (messages.hasNext()) {
Message message = (Message) messages.next();
OfflineMessageInfo info = (OfflineMessageInfo) message.getExtension("offline",
"http://jabber.org/protocol/offline");
assertNotNull("No offline information was included in the offline message", info);
assertNotNull("No stamp was found in the message header", info.getNode());
stamps.add(info.getNode());
}
assertEquals("Wrong number of messages", 2, stamps.size());
// Check that the offline messages have not been deleted
assertEquals("Wrong number of offline messages", 2, offlineManager.getMessageCount());