public static <T> T readJsonSR(
      @Nonnull final byte[] jsonWithMagic,
      final ObjectMapper mapper,
      final Class<? extends T> clazz
  ) throws IOException {
    if (!hasMagicByte(jsonWithMagic)) {
      // don't log contents of jsonWithMagic to avoid leaking data into the logs
      throw new KsqlException(
          "Got unexpected JSON serialization format that did not start with the magic byte. If "
              + "this stream was not serialized using the JsonSchemaConverter, then make sure "
              + "the stream is declared with JSON format (not JSON_SR).");
    }

    return mapper.readValue(
        jsonWithMagic,
        SIZE_OF_SR_PREFIX,
        jsonWithMagic.length - SIZE_OF_SR_PREFIX,
        clazz
    );
  }
@Test
  public void shouldSetCorrectOffsetWithMagicByte() throws IOException {
    // Given:
    byte[] json = new byte[]{/* magic */ 0x00, /* id */ 0x00, 0x00, 0x00, 0x01, /* data */ 0x01};

    // When:
    JsonSerdeUtils.readJsonSR(json, mapper, Object.class);

    // Then:
    Mockito.verify(mapper, Mockito.times(1)).readValue(json, 5, 1, Object.class);
  }