aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-08-15 21:51:44 +0200
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-08-15 21:51:44 +0200
commit44d995273e364aa64a034f30d5d723b995553afd (patch)
tree4c11e38825ff22d03637945b6c04a3c8fd807476 /test
parent4876ceebb07526f1c0215efbcf4afa6ae17b7142 (diff)
downloadjitsi-44d995273e364aa64a034f30d5d723b995553afd.zip
jitsi-44d995273e364aa64a034f30d5d723b995553afd.tar.gz
jitsi-44d995273e364aa64a034f30d5d723b995553afd.tar.bz2
Better checking of IRC chat room name.
Diffstat (limited to 'test')
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java36
1 files changed, 36 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
index 6462df4..ef18049 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java
+++ b/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomIrcImplTest.java
@@ -77,6 +77,25 @@ public class ChatRoomIrcImplTest
}
}
+ //@Test(expected = IllegalArgumentException.class)
+ public void testTooLongName()
+ {
+ EasyMock.replay(this.providerMock, this.stackMock);
+ try
+ {
+ new ChatRoomIrcImpl(
+ "thisjustalittlebittoolongtobeachannelnamethereforeiexpectthe"
+ + "testtofailsoweshallseifthisisthecasethisjustalittlebit"
+ + "toolongtobeachannelnamethereforeiexpectthetesttofails"
+ + "orweshallseeifthisisthecaseorweshallseeifthisisthecase",
+ this.providerMock);
+ fail("Should have failed with IAE.");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
//@Test
public void testAutoPrefixBadChannelName()
{
@@ -440,4 +459,21 @@ public class ChatRoomIrcImplTest
Assert.assertEquals("&MyAlternative-channel-prefix",
alternative.getIdentifier());
}
+
+ public void testOnlyAlternativeChannelTypesWithDefault()
+ {
+ ProtocolProviderServiceIrcImpl specialProviderMock =
+ EasyMock.createMock(ProtocolProviderServiceIrcImpl.class);
+ IrcStack specialStackMock = EasyMock.createMock(IrcStack.class);
+ EasyMock.expect(specialProviderMock.getIrcStack()).andReturn(
+ specialStackMock);
+ EasyMock.expect(specialStackMock.getChannelTypes()).andReturn(
+ Sets.newHashSet('&'));
+ EasyMock.replay(specialProviderMock, specialStackMock);
+ ChatRoomIrcImpl alternative =
+ new ChatRoomIrcImpl("channel-name-without-prefix",
+ specialProviderMock);
+ Assert.assertEquals("#channel-name-without-prefix",
+ alternative.getIdentifier());
+ }
}