@Test
  public void testJsonSerialization() throws Exception {
    ObjectMapper objectMapper = new ObjectMapper();
    StoreKeyJacksonConfig.setupObjectMapper(objectMapper, new MockIdFactory());
    short accountId = 100, containerId = 1000;
    StoreKey key = new MockId(TestUtils.getRandomString(10), accountId, containerId);
    long size = 12345;
    long expirationTime = SystemTime.getInstance().milliseconds() - 1;
    long operationTime = SystemTime.getInstance().milliseconds() + 300;
    Long crc = 1000L;
    short lifeVersion = 5;
    MessageInfo origin =
        new MessageInfo(key, size, false, false, false, expirationTime, crc, accountId, containerId, operationTime,
            lifeVersion);

    String jsonString = objectMapper.writeValueAsString(origin);
    MessageInfo deserialized = objectMapper.readValue(jsonString, MessageInfo.class);

    checkGetters(deserialized, origin.getStoreKey(), origin.getSize(), origin.isDeleted(), origin.isTtlUpdated(),
        origin.isUndeleted(), origin.getExpirationTimeInMs(), origin.getCrc(), origin.getAccountId(),
        origin.getContainerId(), origin.getOperationTimeMs(), origin.getLifeVersion());

    origin = new MessageInfo(key, size, true, true, true, expirationTime, crc, accountId, containerId, operationTime,
        lifeVersion);

    jsonString = objectMapper.writeValueAsString(origin);
    deserialized = objectMapper.readValue(jsonString, MessageInfo.class);

    checkGetters(deserialized, origin.getStoreKey(), origin.getSize(), origin.isDeleted(), origin.isTtlUpdated(),
        origin.isUndeleted(), origin.getExpirationTimeInMs(), origin.getCrc(), origin.getAccountId(),
        origin.getContainerId(), origin.getOperationTimeMs(), origin.getLifeVersion());
  }
Test for serialize and deserialize {@link MessageInfo} using jackson library.
@throws Exception
ambry-api/src/test/java/com/github/ambry/store/MessageInfoTest.java