diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-02-09 15:12:37 +0100 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-07-30 18:30:00 +0200 |
commit | 92419282477010fea9c3335d313ca6ae00745014 (patch) | |
tree | 7625e4fe73f36493dab81ea25904eb2760d15798 /test | |
parent | f735b86f439960c521add671cad7a0691960156b (diff) | |
download | jitsi-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.java | 69 |
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)); + } +} |