1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2025-02-16 06:50:15 -05:00

ConversationReceiverTest: Fix interface implementation.

This commit is contained in:
Sebastian Kaspari 2011-11-26 22:58:15 +01:00
parent 66006cabf5
commit bd17dcd598

View File

@ -29,7 +29,7 @@ import android.test.AndroidTestCase;
/** /**
* Test case for org.yaaic.receiver.ConversationReceiver * Test case for org.yaaic.receiver.ConversationReceiver
* *
* @author Sebastian Kaspari <sebastian@yaaic.org> * @author Sebastian Kaspari <sebastian@yaaic.org>
*/ */
public class ConversationReceiverTest extends AndroidTestCase implements ConversationListener public class ConversationReceiverTest extends AndroidTestCase implements ConversationListener
@ -37,45 +37,45 @@ public class ConversationReceiverTest extends AndroidTestCase implements Convers
private boolean onConversationMessageCalled; private boolean onConversationMessageCalled;
private boolean onNewConversationCalled; private boolean onNewConversationCalled;
private boolean onRemoveConversationCalled; private boolean onRemoveConversationCalled;
private ConversationReceiver receiver; private ConversationReceiver receiver;
private String testTarget = "#unittest"; private String testTarget = "#unittest";
private int serverId = 42; private int serverId = 42;
public void setUp() public void setUp()
{ {
onConversationMessageCalled = false; onConversationMessageCalled = false;
onNewConversationCalled = false; onNewConversationCalled = false;
onRemoveConversationCalled = false; onRemoveConversationCalled = false;
receiver = new ConversationReceiver(serverId, this); receiver = new ConversationReceiver(serverId, this);
} }
public void testMessageBroadcast() public void testMessageBroadcast()
{ {
Intent intent = Broadcast.createConversationIntent(Broadcast.CONVERSATION_MESSAGE, serverId, testTarget); Intent intent = Broadcast.createConversationIntent(Broadcast.CONVERSATION_MESSAGE, serverId, testTarget);
receiver.onReceive(getContext(), intent); receiver.onReceive(getContext(), intent);
assertTrue(onConversationMessageCalled); assertTrue(onConversationMessageCalled);
assertFalse(onNewConversationCalled); assertFalse(onNewConversationCalled);
assertFalse(onRemoveConversationCalled); assertFalse(onRemoveConversationCalled);
} }
public void testNewBroadcast() public void testNewBroadcast()
{ {
Intent intent = Broadcast.createConversationIntent(Broadcast.CONVERSATION_NEW, serverId, testTarget); Intent intent = Broadcast.createConversationIntent(Broadcast.CONVERSATION_NEW, serverId, testTarget);
receiver.onReceive(getContext(), intent); receiver.onReceive(getContext(), intent);
assertFalse(onConversationMessageCalled); assertFalse(onConversationMessageCalled);
assertTrue(onNewConversationCalled); assertTrue(onNewConversationCalled);
assertFalse(onRemoveConversationCalled); assertFalse(onRemoveConversationCalled);
} }
public void testRemoveBroadcast() public void testRemoveBroadcast()
{ {
Intent intent = Broadcast.createConversationIntent(Broadcast.CONVERSATION_REMOVE, serverId, testTarget); Intent intent = Broadcast.createConversationIntent(Broadcast.CONVERSATION_REMOVE, serverId, testTarget);
receiver.onReceive(getContext(), intent); receiver.onReceive(getContext(), intent);
assertFalse(onConversationMessageCalled); assertFalse(onConversationMessageCalled);
assertFalse(onNewConversationCalled); assertFalse(onNewConversationCalled);
assertTrue(onRemoveConversationCalled); assertTrue(onRemoveConversationCalled);
@ -85,7 +85,7 @@ public class ConversationReceiverTest extends AndroidTestCase implements Convers
public void onConversationMessage(String target) public void onConversationMessage(String target)
{ {
assertEquals(testTarget, target); assertEquals(testTarget, target);
onConversationMessageCalled = true; onConversationMessageCalled = true;
} }
@ -93,7 +93,7 @@ public class ConversationReceiverTest extends AndroidTestCase implements Convers
public void onNewConversation(String target) public void onNewConversation(String target)
{ {
assertEquals(testTarget, target); assertEquals(testTarget, target);
onNewConversationCalled = true; onNewConversationCalled = true;
} }
@ -101,7 +101,13 @@ public class ConversationReceiverTest extends AndroidTestCase implements Convers
public void onRemoveConversation(String target) public void onRemoveConversation(String target)
{ {
assertEquals(testTarget, target); assertEquals(testTarget, target);
onRemoveConversationCalled = true; onRemoveConversationCalled = true;
} }
@Override
public void onTopicChanged(String topic)
{
// XXX: Implement me!
}
} }