### Question:
ThriftCacheKey { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_attributes == null) ? 0 : _attributes.hashCode()); result = prime * result + ((_clazz == null) ? 0 : _clazz.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_shards == null) ? 0 : _shards.hashCode()); result = prime * result + ((_table == null) ? 0 : _table.hashCode()); return result; } ThriftCacheKey(Map<String, String> userAttributes, String table, ShardsKey shards, T t, ClassObj<T> clazz); long getTimestamp(); String getTable(); int size(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void test1() throws BlurException { String table = "t"; BlurQuery bq1 = new BlurQuery(); BlurQuery bq2 = new BlurQuery(); ThriftCacheKey<BlurQuery> key1 = new ThriftCacheKey<BlurQuery>(null, table, new ShardsKey(new int[] { 0, 1 }), bq1, new ClassObj<BlurQuery>(BlurQuery.class)); ThriftCacheKey<BlurQuery> key2 = new ThriftCacheKey<BlurQuery>(null, table, new ShardsKey(new int[] { 0, 1 }), bq2, new ClassObj<BlurQuery>(BlurQuery.class)); assertEquals(key1, key2); assertEquals(key1.hashCode(), key2.hashCode()); }
@Test public void test2() throws BlurException { String table = "t"; ThriftCacheKey<BlurQuery> key1 = new ThriftCacheKey<BlurQuery>(null, table, new ShardsKey(new int[] { 0, 1 }), null, new ClassObj<BlurQuery>(BlurQuery.class)); ThriftCacheKey<BlurQuery> key2 = new ThriftCacheKey<BlurQuery>(null, table, new ShardsKey(new int[] { 0, 1 }), null, new ClassObj<BlurQuery>(BlurQuery.class)); assertEquals(key1, key2); assertEquals(key1.hashCode(), key2.hashCode()); }
@Test public void test3() throws BlurException { String table = "t"; BlurQuery bq1 = new BlurQuery(); BlurQuery bq2 = new BlurQuery(); ThriftCacheKey<BlurQuery> key1 = new ThriftCacheKey<BlurQuery>(null, table, new ShardsKey(new int[] { 0, 1 }), bq1, new ClassObj<BlurQuery>(BlurQuery.class)); ThriftCacheKey<BlurQuery> key2 = new ThriftCacheKey<BlurQuery>(null, table, new ShardsKey(new int[] { 0, 1 }), bq2, new ClassObj<BlurQuery>(BlurQuery.class)); assertEquals(key1, key2); assertEquals(key1.hashCode(), key2.hashCode()); }
@Test public void test4() throws BlurException { String table = "t"; BlurQuery bq1 = new BlurQuery(); BlurQuery bq2 = new BlurQuery(); ThriftCacheKey<BlurQuery> key1 = new ThriftCacheKey<BlurQuery>(map("a", "b"), table, new ShardsKey( new int[] { 0, 1 }), bq1, new ClassObj<BlurQuery>(BlurQuery.class)); ThriftCacheKey<BlurQuery> key2 = new ThriftCacheKey<BlurQuery>(map("a", "b"), table, new ShardsKey( new int[] { 0, 1 }), bq2, new ClassObj<BlurQuery>(BlurQuery.class)); assertEquals(key1, key2); assertEquals(key1.hashCode(), key2.hashCode()); }