@Test
  public void offsetBadInputTest() throws IOException {
    doBadOffsetInputTest(null, 10);
    doBadOffsetInputTest(LogSegmentName.fromString("1_11"), -1);

    Offset offset = new Offset(LogSegmentName.fromString("1_11"), 10);
    byte[] serialized = offset.toBytes();
    // mess with a version byte
    serialized[0] = serialized[0] == (byte) 1 ? (byte) 2 : (byte) 1;
    try {
      Offset.fromBytes(new DataInputStream(new ByteBufferInputStream(ByteBuffer.wrap(serialized))));
      fail("Version check should have failed");
    } catch (IllegalArgumentException e) {
      // expected.
    }
  }
Tests the constructor and {@link Offset#fromBytes(DataInputStream)} function with bad input.
@throws IOException
ambry-store/src/test/java/com/github/ambry/store/OffsetTest.java