diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-08-12 20:18:24 +0200 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-08-12 20:18:24 +0200 |
commit | c205a4926303d62688a8612cac38ce06eca760dc (patch) | |
tree | 2fb03b7fad7ef3eb21e5145ebe52d7719cdae81f /test | |
parent | 7a1ef1a22810a69cf60f53ecedcb4e70a68a7481 (diff) | |
download | jitsi-c205a4926303d62688a8612cac38ce06eca760dc.zip jitsi-c205a4926303d62688a8612cac38ce06eca760dc.tar.gz jitsi-c205a4926303d62688a8612cac38ce06eca760dc.tar.bz2 |
Added test for remaining methods of IrcAccountID.
Diffstat (limited to 'test')
-rw-r--r-- | test/net/java/sip/communicator/impl/protocol/irc/IrcAccountIDTest.java | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/IrcAccountIDTest.java b/test/net/java/sip/communicator/impl/protocol/irc/IrcAccountIDTest.java index 5849ace..aca3c01 100644 --- a/test/net/java/sip/communicator/impl/protocol/irc/IrcAccountIDTest.java +++ b/test/net/java/sip/communicator/impl/protocol/irc/IrcAccountIDTest.java @@ -43,6 +43,42 @@ public class IrcAccountIDTest } } + public void testServiceNameMinimal() + { + HashMap<String, String> properties = new HashMap<String, String>(); + properties.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); + IrcAccountID account = + new IrcAccountID("user", "host", "6667", properties); + Assert.assertEquals(ProtocolNames.IRC, account.getService()); + Assert.assertEquals("user@host:6667 (" + ProtocolNames.IRC + ")", + account.getDisplayName()); + } + + public void testServiceNameWithHost() + { + HashMap<String, String> properties = new HashMap<String, String>(); + properties.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); + properties.put(ProtocolProviderFactory.SERVER_ADDRESS, "localhost"); + IrcAccountID account = + new IrcAccountID("user", "localhost", "6667", properties); + Assert.assertEquals("localhost", account.getService()); + Assert.assertEquals("user@localhost:6667 (" + ProtocolNames.IRC + ")", + account.getDisplayName()); + } + + public void testServiceNameWithHostAndPort() + { + HashMap<String, String> properties = new HashMap<String, String>(); + properties.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); + properties.put(ProtocolProviderFactory.SERVER_ADDRESS, "localhost"); + properties.put(ProtocolProviderFactory.SERVER_PORT, "6667"); + IrcAccountID account = + new IrcAccountID("user", "host", "6667", properties); + Assert.assertEquals("localhost:6667", account.getService()); + Assert.assertEquals("user@host:6667 (" + ProtocolNames.IRC + ")", + account.getDisplayName()); + } + public void testCorrectConstruction() { HashMap<String, String> properties = new HashMap<String, String>(); @@ -123,4 +159,30 @@ public class IrcAccountIDTest // only test that it does not throw an exception account.hashCode(); } + + public void testAccountDisplayNamePropertySet() + { + HashMap<String, String> properties = new HashMap<String, String>(); + properties.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); + properties.put(ProtocolProviderFactory.SERVER_ADDRESS, "localhost"); + properties.put(ProtocolProviderFactory.SERVER_PORT, "6667"); + properties.put(ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME, + "my-IRC-account-name"); + IrcAccountID account = + new IrcAccountID("user", "host", "6667", properties); + Assert.assertEquals("my-IRC-account-name", account.getDisplayName()); + } + + public void testAccountDisplayNamePropertySetButEmpty() + { + HashMap<String, String> properties = new HashMap<String, String>(); + properties.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.IRC); + properties.put(ProtocolProviderFactory.SERVER_ADDRESS, "localhost"); + properties.put(ProtocolProviderFactory.SERVER_PORT, "6667"); + properties.put(ProtocolProviderFactory.ACCOUNT_DISPLAY_NAME, ""); + IrcAccountID account = + new IrcAccountID("user", "host", "6667", properties); + Assert.assertEquals("user@host:6667 (" + ProtocolNames.IRC + ")", + account.getDisplayName()); + } } |