@Test public void testHashCode() throws Exception { WriteOperation op1 = new WriteOperation(new Element(OUR_KEY, "someValue")); WriteOperation op2 = new WriteOperation(new Element(OUR_KEY, "someOtherValue")); WriteOperation op3 = new WriteOperation(new Element(OUR_KEY, "someValue")); assertThat("A write operation should have the same hashCode as its key", op1.hashCode(), is(OUR_KEY.hashCode())); assertThat("Two write operations for the same key but different values should still have the same hashCode", op1.hashCode(), is(op2.hashCode())); assertThat("Two write operations for the same key and same value should have the same hashCode", op2.hashCode(), is(op3.hashCode())); }
@Override public int hashCode() { return element.hashCode(); }
WriteOperation implements SingleOperation { @Override public int hashCode() { return element.hashCode(); } }
WriteOperation implements SingleOperation { @Override public int hashCode() { return element.hashCode(); } WriteOperation(Element element);  WriteOperation(Element element, long creationTime); }
WriteOperation implements SingleOperation { @Override public int hashCode() { return element.hashCode(); } WriteOperation(Element element);  WriteOperation(Element element, long creationTime); void performSingleOperation(CacheWriter cacheWriter); BatchOperation createBatchOperation(List<SingleOperation> operations); Object getKey(); long getCreationTime(); Element getElement(); SingleOperationType getType(); @Override boolean equals(final Object o); @Override int hashCode(); }
WriteOperation implements SingleOperation { @Override public int hashCode() { return element.hashCode(); } WriteOperation(Element element);  WriteOperation(Element element, long creationTime); void performSingleOperation(CacheWriter cacheWriter); BatchOperation createBatchOperation(List<SingleOperation> operations); Object getKey(); long getCreationTime(); Element getElement(); SingleOperationType getType(); @Override boolean equals(final Object o); @Override int hashCode();  }