@Test
  public void equalsAndHashCodeTest() {
    Offset o1 = new Offset(LogSegmentName.fromString("1_1"), 2);
    Offset o2 = new Offset(LogSegmentName.fromString("1_1"), 2);
    Offset o3 = new Offset(LogSegmentName.fromString("1_1"), 3);
    Offset o4 = new Offset(LogSegmentName.fromString("1_2"), 2);

    assertTrue("Offset should be equal to itself", o1.equals(o1));
    assertFalse("Offset should not be equal to null", o1.equals(null));
    assertFalse("Offset should not be equal to random Object", o1.equals(new Object()));

    assertTrue("Offsets should be declared equal", o1.equals(o2));
    assertEquals("Hashcode mismatch", o1.hashCode(), o2.hashCode());

    assertFalse("Offsets should be declared unequal", o1.equals(o3));
    assertFalse("Offsets should be declared unequal", o1.equals(o4));
  }
Tests for {@link Offset#equals(Object)} and {@link Offset#hashCode()}.
ambry-store/src/test/java/com/github/ambry/store/OffsetTest.java