SchemaSerializer extends JsonSerializer<Schema> { @Override public void serialize(Schema schema, JsonGenerator generator, SerializerProvider provider) throws IOException, JsonProcessingException { generator.writeObject(mapper.readTree(schema.toString())); }  @Override void serialize(Schema schema, JsonGenerator generator, SerializerProvider provider); @Override Class<Schema> handledType();  }
@Test public void test() throws JsonProcessingException, IOException { new SchemaSerializer().serialize(schema, generator, null); verify(generator).writeObject(jsonNode); }