public static <T> AvroSchema<T> of(SchemaDefinition<T> schemaDefinition) {
        if (schemaDefinition.getSchemaReaderOpt().isPresent() && schemaDefinition.getSchemaWriterOpt().isPresent()) {
            return new AvroSchema<>(schemaDefinition.getSchemaReaderOpt().get(),
                    schemaDefinition.getSchemaWriterOpt().get(), parseSchemaInfo(schemaDefinition, SchemaType.AVRO));
        }
        ClassLoader pojoClassLoader = null;
        if (schemaDefinition.getClassLoader() != null) {
            pojoClassLoader = schemaDefinition.getClassLoader();
        } else if (schemaDefinition.getPojo() != null) {
            pojoClassLoader = schemaDefinition.getPojo().getClassLoader();
        }

        return new AvroSchema<>(parseSchemaInfo(schemaDefinition, SchemaType.AVRO), pojoClassLoader);
    }
@Test
    public void testTimestampWithJsonDef(){
        AvroSchema<TimestampPojo> schemaWithPojo = AvroSchema.of(SchemaDefinition.<TimestampPojo>builder()
                .withPojo(TimestampPojo.class)
                .withJSR310ConversionEnabled(false).build());

        TimestampPojo timestampPojo = new TimestampPojo(Instant.parse("2022-06-10T12:38:59.039084Z"));
        byte[] encode = schemaWithPojo.encode(timestampPojo);
        TimestampPojo decodeWithPojo = schemaWithPojo.decode(encode);

        Assert.assertEquals(decodeWithPojo, timestampPojo);

        String schemaDefinition = new String(schemaWithPojo.schemaInfo.getSchema());
        AvroSchema<TimestampPojo> schemaWithJsonDef = AvroSchema.of(SchemaDefinition.<TimestampPojo>builder()
                .withJsonDef(schemaDefinition)
                .withClassLoader(TimestampPojo.class.getClassLoader())
                .withJSR310ConversionEnabled(false).build());

        TimestampPojo decodeWithJson = schemaWithJsonDef.decode(encode);

        Assert.assertEquals(decodeWithJson, decodeWithPojo);
        Assert.assertEquals(Instant.class, decodeWithJson.getValue().getClass());

        AvroSchema<TimestampPojo> schemaWithJsonDefNoClassLoader = AvroSchema.of(SchemaDefinition.<TimestampPojo>builder()
                .withJsonDef(schemaDefinition)
                .withJSR310ConversionEnabled(false).build());

        TimestampPojo decodeWithJsonNoClassLoader = schemaWithJsonDefNoClassLoader.decode(encode);
        Assert.assertNotEquals(decodeWithJsonNoClassLoader, decodeWithPojo);
        Assert.assertNotEquals(Instant.class, decodeWithJsonNoClassLoader.getValue().getClass());
    }