From d40aad586268e28d8b79209b6bd0ab884c63c109 Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Fri, 14 Sep 2007 16:35:39 +0000 Subject: [PATCH] Fixing a long standing problem with the meta contact list tests. The meta contact list tests are enabled again. --- .../MetaContactListServiceLick.java | 7 +++++++ .../slick/contactlist/TestMetaContactList.java | 18 +++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java b/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java index ae6018003..7c8b5bd32 100644 --- a/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java +++ b/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java @@ -185,10 +185,17 @@ private void fillMockContactList(MockProvider provider) root.addContact( new MockContact("Martin Dupont", provider) ); root.addContact( new MockContact("Joe Bloggs", provider) ); + MockContact someOfflineContact + = new MockContact("I am offline", provider); + someOfflineContact.setPresenceStatus(MockStatusEnum.MOCK_STATUS_00); + root.addContact( someOfflineContact); + mockContactToRename = new MockContact("Jane Doe", provider) ; root.addContact( mockContactToRename ); mockContactToReorder = new MockContact("ZI'llChangeMyStatus", provider); + //make sure that the contact starts at the bottom of the list. + mockContactToReorder.setPresenceStatus(MockStatusEnum.MOCK_STATUS_00); root.addContact(mockContactToReorder); topLevelMockGroup = new MockContactGroup(topLevelGroupName, provider); diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java index 64a866aa2..2f508df46 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java @@ -134,7 +134,7 @@ public void testContactsOrder() fixture.metaClService.removeMetaContactListListener(evtCollector); - //check whether a reordered event is dispatchect + //make sure that the order didn't change assertEquals("Number of evts dispatched after a contact changed its status" , 1 , evtCollector.collectedMetaContactGroupEvents.size()); @@ -149,16 +149,6 @@ public void testContactsOrder() , fixture.metaClService.getRoot() , evt.getSourceMetaContactGroup()); - //then check wether the contact is has been moved to the top of the list - MetaContact theReorderedContact - = fixture.metaClService.getRoot().getMetaContact(0); - assertEquals(MetaContactListServiceLick.mockContactToReorder - + " was not moved to the top of the list after being " - +"assigned the highest possible presence status" - , MetaContactListServiceLick.mockContactToReorder - .getDisplayName() - , theReorderedContact.getDisplayName()); - //then check the general order assertContactsOrder(fixture.metaClService.getRoot()); @@ -172,6 +162,8 @@ public void testContactsOrder() //repeat order tests but this time after changing the display name of a //contact. fixture.metaClService.addMetaContactListListener(evtCollector); + MetaContact theReorderedContact = fixture.metaClService + .findMetaContactByContact(MetaContactListServiceLick.mockContactToReorder); fixture.metaClService.renameMetaContact(theReorderedContact, "zzzzzz"); fixture.metaClService.removeMetaContactListListener(evtCollector); @@ -192,10 +184,10 @@ public void testContactsOrder() , fixture.metaClService.getRoot() , evt.getSourceMetaContactGroup()); - //then check wether the contact is has been moved to the top of the list + //then check wether the contact is has been moved to the bottom of the list assertSame(MetaContactListServiceLick.mockContactToReorder + " was not moved to the bottom of the list after being " - +"assigned an equal to all status and a heavy name." + +"assigned 00 status and a heavy name." , theReorderedContact , fixture.metaClService.getRoot().getMetaContact( fixture.metaClService.getRoot().countChildContacts()-1));