aboutsummaryrefslogtreecommitdiffstats
path: root/test/net
diff options
context:
space:
mode:
Diffstat (limited to 'test/net')
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java86
1 files changed, 86 insertions, 0 deletions
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java b/test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java
new file mode 100644
index 0000000..4e97ffe
--- /dev/null
+++ b/test/net/java/sip/communicator/impl/protocol/irc/command/MeTest.java
@@ -0,0 +1,86 @@
+package net.java.sip.communicator.impl.protocol.irc.command;
+
+import junit.framework.*;
+import net.java.sip.communicator.impl.protocol.irc.*;
+
+import org.easymock.*;
+
+import com.ircclouds.irc.api.*;
+
+public class MeTest extends TestCase
+{
+
+ public void testConstruction()
+ {
+ new Me();
+ }
+
+ public void testGoodInit()
+ {
+ IrcConnection connection = EasyMock.createMock(IrcConnection.class);
+ EasyMock.replay(connection);
+
+ Me me = new Me();
+ me.init(null, connection);
+ }
+
+ public void testBadInit()
+ {
+ ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
+ EasyMock.replay(provider);
+
+ Me me = new Me();
+ try
+ {
+ me.init(provider, null);
+ Assert.fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testNoMessage()
+ {
+ ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
+ IrcConnection connection = EasyMock.createMock(IrcConnection.class);
+ EasyMock.replay(provider, connection);
+
+ Me me = new Me();
+ me.init(provider, connection);
+ me.execute("#test", "/me");
+ }
+
+ public void testZeroLengthMessage()
+ {
+ ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
+ IrcConnection connection = EasyMock.createMock(IrcConnection.class);
+ EasyMock.replay(provider, connection);
+
+ Me me = new Me();
+ me.init(provider, connection);
+ try
+ {
+ me.execute("#test", "/me ");
+ Assert.fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testSendMessage()
+ {
+ ProtocolProviderServiceIrcImpl provider = EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
+ IrcConnection connection = EasyMock.createMock(IrcConnection.class);
+ IRCApi client = EasyMock.createMock(IRCApi.class);
+ EasyMock.expect(connection.getClient()).andReturn(client);
+ client.act(EasyMock.eq("#test"), EasyMock.eq("says hello world!"));
+ EasyMock.expectLastCall();
+ EasyMock.replay(provider, connection, client);
+
+ Me me = new Me();
+ me.init(provider, connection);
+ me.execute("#test", "/me says hello world!");
+ }
+}