aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-02-09 15:12:37 +0100
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-07-30 18:30:00 +0200
commit92419282477010fea9c3335d313ca6ae00745014 (patch)
tree7625e4fe73f36493dab81ea25904eb2760d15798 /test
parentf735b86f439960c521add671cad7a0691960156b (diff)
downloadjitsi-92419282477010fea9c3335d313ca6ae00745014.zip
jitsi-92419282477010fea9c3335d313ca6ae00745014.tar.gz
jitsi-92419282477010fea9c3335d313ca6ae00745014.tar.bz2
Tests specifying desired control code parsing behavior.
Diffstat (limited to 'test')
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java b/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java
new file mode 100644
index 0000000..0d61313
--- /dev/null
+++ b/test/net/java/sip/communicator/impl/protocol/irc/UtilsTest.java
@@ -0,0 +1,69 @@
+package net.java.sip.communicator.impl.protocol.irc;
+
+import junit.framework.*;
+
+public class UtilsTest
+ extends TestCase
+{
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testNullText()
+ {
+ Assert.assertEquals(null, Utils.parse(null));
+ }
+
+ public void testParseEmptyString()
+ {
+ Assert.assertEquals("", Utils.parse(""));
+ }
+
+ public void testParseStringWithoutControlCodes()
+ {
+ final String message = "My normal message without any control codes.";
+ Assert.assertEquals(message, Utils.parse(message));
+ }
+
+ public void testParseStringWithBoldCode()
+ {
+ final String ircMessage = "My \u0002bold\u0002 message.";
+ final String htmlMessage = "My <b>bold</b> message.";
+ Assert.assertEquals(htmlMessage, Utils.parse(ircMessage));
+ }
+
+ public void testParseStringWithItalicsCode()
+ {
+ final String ircMessage = "My \u001Ditalics\u001D message.";
+ final String htmlMessage = "My <i>italics</i> message.";
+ Assert.assertEquals(htmlMessage, Utils.parse(ircMessage));
+ }
+
+ public void testParseStringWithUnderlineCode()
+ {
+ final String ircMessage = "My \u001Funderlined\u001F message.";
+ final String htmlMessage = "My <u>italics</u> message.";
+ Assert.assertEquals(htmlMessage, Utils.parse(ircMessage));
+ }
+
+ public void testParseStringWithForegroundColorCode()
+ {
+ final String ircMessage = "My \u000304RED\u0003 message.";
+ final String htmlMessage = "My <font color=\"red\">RED</font> message.";
+ Assert.assertEquals(htmlMessage, Utils.parse(ircMessage));
+ }
+
+ public void testParseStringWithForegroundAndBackgroundColorCode()
+ {
+ final String ircMessage = "My \u000304,12RED on Light Blue\u0003 message.";
+ final String htmlMessage = "My <font color=\"red\" bgcolor=\"lightblue\">RED on Light Blue</font> message.";
+ Assert.assertEquals(htmlMessage, Utils.parse(ircMessage));
+ }
+}