aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-08-02 01:07:19 +0200
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-08-02 01:07:19 +0200
commitbfb5f3a8eb08db001e611254fa300c107d27d50b (patch)
tree04b3a2fee7fd9ed2eebe5ebe78c14ba9f7f76b3f
parentd30aa044d4aabfdbbebd4deddaf8ea447a35fccf (diff)
downloadjitsi-bfb5f3a8eb08db001e611254fa300c107d27d50b.zip
jitsi-bfb5f3a8eb08db001e611254fa300c107d27d50b.tar.gz
jitsi-bfb5f3a8eb08db001e611254fa300c107d27d50b.tar.bz2
Specialized hashCode(), includes test.
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImpl.java7
-rw-r--r--test/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImplTest.java11
2 files changed, 13 insertions, 5 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImpl.java
index ab872bd..3f233c7 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImpl.java
@@ -225,11 +225,8 @@ public class ChatRoomMemberIrcImpl
{
final int prime = 31;
int result = 1;
- result =
- prime * result + ((contactID == null) ? 0 : contactID.hashCode());
- result =
- prime * result
- + ((parentProvider == null) ? 0 : parentProvider.hashCode());
+ result = prime * result + contactID.hashCode();
+ result = prime * result + parentProvider.hashCode();
return result;
}
diff --git a/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImplTest.java b/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImplTest.java
index 2761f9d..20a931b 100644
--- a/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImplTest.java
+++ b/test/net/java/sip/communicator/impl/protocol/irc/ChatRoomMemberIrcImplTest.java
@@ -300,4 +300,15 @@ public class ChatRoomMemberIrcImplTest
"susy", ChatRoomMemberRole.SILENT_MEMBER);
Assert.assertTrue(member1.equals(member2));
}
+
+ public void testHashcodeNotFailing()
+ {
+ ChatRoom chatroom = EasyMock.createMock(ChatRoom.class);
+ ProtocolProviderService provider =
+ EasyMock.createMock(ProtocolProviderService.class);
+ ChatRoomMemberIrcImpl member =
+ new ChatRoomMemberIrcImpl(provider, chatroom, "ET",
+ ChatRoomMemberRole.ADMINISTRATOR);
+ member.hashCode();
+ }
}