aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-08-02 23:12:26 +0200
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-08-02 23:16:52 +0200
commit9158ee17ef3feb7f6a527d5972c3bf725c87ee4b (patch)
treec7eacc11310473843331733a7b2ebf707454140f /test
parentb2d8ffc7c7f7111792093d352289501408233800 (diff)
downloadjitsi-9158ee17ef3feb7f6a527d5972c3bf725c87ee4b.zip
jitsi-9158ee17ef3feb7f6a527d5972c3bf725c87ee4b.tar.gz
jitsi-9158ee17ef3feb7f6a527d5972c3bf725c87ee4b.tar.bz2
Added some tests, but they still fail since we don't have JUnit4 active yet.
Diffstat (limited to 'test')
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java77
1 files changed, 77 insertions, 0 deletions
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java b/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java
new file mode 100644
index 0000000..c8ee91d
--- /dev/null
+++ b/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java
@@ -0,0 +1,77 @@
+package net.java.sip.communicator.impl.protocol.irc;
+
+import java.util.*;
+
+import junit.framework.*;
+
+import org.easymock.*;
+
+import com.google.common.collect.*;
+
+public class ChatRoomIrcImplTest
+ extends TestCase
+{
+ private ProtocolProviderServiceIrcImpl providerMock;
+ private IrcStack stackMock;
+
+ //@before
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ this.providerMock =
+ EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
+ this.stackMock = EasyMock.createMock(IrcStack.class);
+ EasyMock.expect(this.providerMock.getIrcStack()).andReturn(stackMock);
+ EasyMock.expect(this.stackMock.getChannelTypes()).andReturn(
+ Collections.unmodifiableSet(Sets.newHashSet('#', '$')));
+ }
+
+ //@Test
+ public void testConstruction()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl("#test", this.providerMock);
+ }
+
+ //@Test(expected = IllegalArgumentException.class)
+ public void testConstructionNullIdentifier()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl(null, this.providerMock);
+ }
+
+ //@Test(expected = IllegalArgumentException.class)
+ public void testConstructionNullProvider()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl("#test", null);
+ }
+
+ //@Test(expected = IllegalArgumentException.class)
+ public void testIllegalNameBadPrefix()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl("!test", this.providerMock);
+ }
+
+ //@Test(expected = IllegalArgumentException.class)
+ public void testIllegalNameSpace()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl("#test test", this.providerMock);
+ }
+
+ //@Test(expected = IllegalArgumentException.class)
+ public void testIllegalNameComma()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl("#test,test", this.providerMock);
+ }
+
+ //@Test
+ public void testValidName()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ new ChatRoomIrcImpl("#my-cool-channel", this.providerMock);
+ }
+}