// deleteMessageCollection()
public void testMessageCollections() throws Exception {
manager = new MessageManagerImpl();
manager.setRegistry(registry);
MessageCollection msgColl = new MessageCollectionImpl();
msgColl.setTitle("inbox");
msgColl.setUnread(3);
msgColl.setUpdated(new Date());
msgColl.setId("1");
msgColl.setTotal(10);
List<Url> collectionUrls = new ArrayList<Url>();
Url url = new UrlImpl();
url.setValue("testURL");
collectionUrls.add(url);
msgColl.setUrls(collectionUrls);
/* create message collection */
manager.createMessageCollection("UserZ", msgColl, "1");
Set<String> fields = new HashSet<String>();
fields.add("id");
fields.add("TITLE");
fields.add("total");
fields.add("unread");
fields.add("updated");
fields.add("urls");
/* get message collection */
MessageCollection[] result1 = manager.getMessageCollections("UserZ", fields, null);
assertNotNull(result1);
assertEquals(1, result1.length);
assertEquals(new Integer(10), result1[0].getTotal());
assertNotNull(result1[0].getTitle());
assertEquals("inbox", result1[0].getTitle());
assertNotNull(result1[0].getId());
assertNotNull(result1[0].getUnread());
assertNotNull(result1[0].getUpdated());
assertEquals(msgColl.getUpdated(), result1[0].getUpdated());
msgColl.setTitle("All Messages");
msgColl.setUnread(2);
/* modify message collection */
manager.modifyMessageCollection("UserZ", msgColl, "1");
result1 = manager.getMessageCollections("UserZ", fields, null);
assertNotNull(result1);
assertEquals(1, result1.length);
assertEquals(new Integer(10), result1[0].getTotal());
assertNotNull(result1[0].getTitle());
assertEquals("All Messages", result1[0].getTitle());
assertNotNull(result1[0].getId());
assertNotNull(result1[0].getUnread());
assertEquals(new Integer(2), result1[0].getUnread());
assertNotNull(result1[0].getUpdated());
assertEquals(msgColl.getUpdated(), result1[0].getUpdated());
/* delete message collection */
manager.deleteMessageCollection("UserZ", "1");
result1 = manager.getMessageCollections("UserZ", fields, null);
assertNull(result1);
}