From a4eef678963018603cbc3dba4b8bcbf1a55b49e6 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Tue, 2 Dec 2003 01:58:08 +0000 Subject: [PATCH] Adds test cases for renaming roster groups git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2177 b35dd754-fafc-0310-a699-88a17e54d16e --- test/org/jivesoftware/smack/RosterTest.java | 36 +++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/test/org/jivesoftware/smack/RosterTest.java b/test/org/jivesoftware/smack/RosterTest.java index ae6d7d8d5..714802137 100644 --- a/test/org/jivesoftware/smack/RosterTest.java +++ b/test/org/jivesoftware/smack/RosterTest.java @@ -218,9 +218,7 @@ public class RosterTest extends TestCase { } /** - * 1. Create unfiled entries - * 2. Iterate on all the entries and remove them from the roster - * 3. Check that the number of entries and groups is zero + * Test presence management. */ public void testRosterPresences() { try { @@ -279,6 +277,38 @@ public class RosterTest extends TestCase { } } + /** + * Test if renaming a roster group works fine. + * + */ + public void testRenameRosterGroup() { + try { + // Add a new roster entry + conn1.getRoster().createEntry("gato11@" + conn1.getHost(), "gato11", new String[] {"Friends"}); + conn1.getRoster().createEntry("gato12@" + conn1.getHost(), "gato12", new String[] {"Friends"}); + + Thread.sleep(200); + + conn1.getRoster().getGroup("Friends").setName("Amigos"); + Thread.sleep(200); + assertNull("The group Friends still exists", conn1.getRoster().getGroup("Friends")); + assertNotNull("The group Amigos does not exist", conn1.getRoster().getGroup("Amigos")); + assertEquals("Wrong number of entries in the group Amigos ", 2, conn1.getRoster().getGroup("Amigos").getEntryCount()); + + + conn1.getRoster().getGroup("Amigos").setName(""); + Thread.sleep(200); + assertNull("The group Amigos still exists", conn1.getRoster().getGroup("Amigos")); + assertNotNull("The group with no name does not exist", conn1.getRoster().getGroup("")); + assertEquals("Wrong number of entries in the group \"\" ", 2, conn1.getRoster().getGroup("").getEntryCount()); + + cleanUpRoster(); + } + catch (Exception e) { + fail(e.getMessage()); + } + } + /** * Clean up all the entries in the roster */