@Test public void testEquals() { AbstractEntryWrapper uut = new AbstractEntryWrapper(mockedImg); AbstractEntryWrapper uut2 = new AbstractEntryWrapper(mockedImgNotEqual); assertTrue(uut.equals(uut)); assertFalse(uut.equals(uut2)); assertFalse(uut.equals(null)); assertFalse(uut.equals(nullEntry)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractEntry<?> other = (AbstractEntry<?>) obj; if (data == null) { if (other.data != null) { return false; } } else if (!data.equals(other.data)) { return false; } return true; }
AbstractEntry implements ICacheEntry<D> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractEntry<?> other = (AbstractEntry<?>) obj; if (data == null) { if (other.data != null) { return false; } } else if (!data.equals(other.data)) { return false; } return true; } }
AbstractEntry implements ICacheEntry<D> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractEntry<?> other = (AbstractEntry<?>) obj; if (data == null) { if (other.data != null) { return false; } } else if (!data.equals(other.data)) { return false; } return true; } AbstractEntry(D data); }
AbstractEntry implements ICacheEntry<D> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractEntry<?> other = (AbstractEntry<?>) obj; if (data == null) { if (other.data != null) { return false; } } else if (!data.equals(other.data)) { return false; } return true; } AbstractEntry(D data); @Override D getData(); @Override abstract void wasUsed(); @Override long getId(); @Override long getByteSize(); @Override int hashCode(); @Override boolean equals(Object obj); }
AbstractEntry implements ICacheEntry<D> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractEntry<?> other = (AbstractEntry<?>) obj; if (data == null) { if (other.data != null) { return false; } } else if (!data.equals(other.data)) { return false; } return true; } AbstractEntry(D data); @Override D getData(); @Override abstract void wasUsed(); @Override long getId(); @Override long getByteSize(); @Override int hashCode(); @Override boolean equals(Object obj);  }