diff options
Diffstat (limited to 'test/net/java/sip/communicator/impl/protocol/irc/IrcAccountIDTest.java')
-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()); + } } |