@Test public void testEquals() throws Exception { DeleteOperation op1 = new DeleteOperation(new CacheEntry(OUR_KEY, new Element(OUR_KEY, "someValue"))); DeleteOperation op2 = new DeleteOperation(new CacheEntry(OUR_KEY, new Element(OUR_KEY, "someOtherValue"))); DeleteOperation op3 = new DeleteOperation(new CacheEntry(OTHER_KEY, new Element(OTHER_KEY, "someOtherValue"))); assertThat("Two delete operations for the same key are to be considered equal", op1.equals(op2), is(true)); assertThat("Two delete operations for the different keys are not to be equal", op1.equals(op3), is(false)); }
@Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DeleteOperation that = (DeleteOperation) o; return entry.getKey().equals(that.getKey()); }
DeleteOperation implements SingleOperation { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DeleteOperation that = (DeleteOperation) o; return entry.getKey().equals(that.getKey()); } }
DeleteOperation implements SingleOperation { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DeleteOperation that = (DeleteOperation) o; return entry.getKey().equals(that.getKey()); } DeleteOperation(CacheEntry entry);  DeleteOperation(CacheEntry entry, long creationTime); }
DeleteOperation implements SingleOperation { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DeleteOperation that = (DeleteOperation) o; return entry.getKey().equals(that.getKey()); } DeleteOperation(CacheEntry entry);  DeleteOperation(CacheEntry entry, long creationTime); void performSingleOperation(CacheWriter cacheWriter); BatchOperation createBatchOperation(List<SingleOperation> operations); Object getKey(); long getCreationTime(); CacheEntry getEntry(); SingleOperationType getType(); @Override boolean equals(final Object o); @Override int hashCode(); }
DeleteOperation implements SingleOperation { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final DeleteOperation that = (DeleteOperation) o; return entry.getKey().equals(that.getKey()); } DeleteOperation(CacheEntry entry);  DeleteOperation(CacheEntry entry, long creationTime); void performSingleOperation(CacheWriter cacheWriter); BatchOperation createBatchOperation(List<SingleOperation> operations); Object getKey(); long getCreationTime(); CacheEntry getEntry(); SingleOperationType getType(); @Override boolean equals(final Object o); @Override int hashCode();  }