### Question:
HServerAddress implements WritableComparable<HServerAddress> { @Override public int hashCode() { int result = address == null? 0: address.hashCode(); result ^= toString().hashCode(); return result; } HServerAddress();  HServerAddress(InetSocketAddress address);  HServerAddress(final String hostname, final int port);  HServerAddress(HServerAddress other); String getBindAddress(); int getPort(); String getHostname(); String getHostnameAndPort(); InetSocketAddress getInetSocketAddress(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); void readFields(DataInput in); void write(DataOutput out); int compareTo(HServerAddress o);  }### Answer:
@Test public void testHashCode() { HServerAddress hsa1 = new HServerAddress("localhost", 1234); HServerAddress hsa2 = new HServerAddress("localhost", 1234); assertEquals(hsa1.hashCode(), hsa2.hashCode()); HServerAddress hsa3 = new HServerAddress("localhost", 1235); assertNotSame(hsa1.hashCode(), hsa3.hashCode()); }