ClusterShardHostPort { @Override public boolean equals(Object obj) { if(this == obj){ return true; } if(!(obj instanceof ClusterShardHostPort)){ return false; } ClusterShardHostPort other = (ClusterShardHostPort) obj; if(!(ObjectUtils.equals(this.clusterName, other.clusterName))){ return false; } if(!(ObjectUtils.equals(this.shardName, other.shardName))){ return false; } if(!(ObjectUtils.equals(this.hostPort, other.hostPort))){ return false; } return true; } ClusterShardHostPort(String clusterName, String shardName, HostPort hostPort);  ClusterShardHostPort(String clusterName, String shardName);  ClusterShardHostPort(HostPort hostPort); HostPort getHostPort(); void setHostPort(HostPort hostPort); String getClusterName(); String getShardName(); void setClusterName(String clusterName); void setShardName(String shardName); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals(){ ClusterShardHostPort clusterShardHostPort = new ClusterShardHostPort("cluster1", "shard1", new HostPort("127.0.0.1", 6379)); ClusterShardHostPort clusterShardHostPort2 = new ClusterShardHostPort("cluster1", "shard1", new HostPort("127.0.0.1", 6379)); Assert.assertTrue(clusterShardHostPort.equals(clusterShardHostPort)); Assert.assertTrue(clusterShardHostPort.equals(clusterShardHostPort2)); Assert.assertFalse(clusterShardHostPort.equals(null)); ClusterShardHostPort clusterShardHostPort3 = new ClusterShardHostPort("cluster1", "shard1", new HostPort("127.0.0.1", 63791)); Assert.assertFalse(clusterShardHostPort.equals(clusterShardHostPort3)); }