1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 23:42:06 +01:00

Adds new tests for setting a new name and group to an unfiled unnamed entry.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2343 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-07-15 02:35:54 +00:00 committed by gdombiak
parent ae17aca127
commit 2b41ad0ccf

View file

@ -249,6 +249,49 @@ public class RosterTest extends SmackTestCase {
} }
} }
/**
* 1. Create an unfiled entry with no name
* 2. Check that the the entry does not belong to any group
* 3. Change its name and add it to a group
* 4. Check that the name has been modified and that the entry belongs to a group
*/
public void testChangeGroupAndNameToUnfiledEntry() {
try {
// Add a new roster entry
Roster roster = getConnection(0).getRoster();
roster.createEntry(getBareJID(1), null, null);
Thread.sleep(200);
getConnection(1).getRoster().createEntry(getBareJID(0), null, null);
Thread.sleep(200);
Iterator it = roster.getEntries();
while (it.hasNext()) {
RosterEntry entry = (RosterEntry) it.next();
assertFalse("The roster entry belongs to a group", entry.getGroups().hasNext());
}
// Change the roster entry name and check if the change was made
roster.createEntry(getBareJID(1), "NewName", new String[] { "Friends" });
// Reload the roster and check the name again
Thread.sleep(200);
it = roster.getEntries();
while (it.hasNext()) {
RosterEntry entry = (RosterEntry) it.next();
assertEquals("Name of roster entry is wrong", "NewName", entry.getName());
assertTrue("The roster entry does not belong to any group", entry.getGroups()
.hasNext());
}
cleanUpRoster();
} catch (Exception e) {
fail(e.getMessage());
}
}
/** /**
* Test if renaming a roster group works fine. * Test if renaming a roster group works fine.
* *