SchemaStringConverter implements UnaryOperatorInterface<String, Schema> { @Override public Schema apply(String s) { Gson gson = new GsonBuilder().registerTypeAdapter(FieldType.class, new FieldDeserializer()).create(); return gson.fromJson(s, Schema.class); }  @Override Schema apply(String s);  }
@Test public void testApply() throws Exception { String filePath = "src/test/resources/RBSchema.json"; JsonSchemaConvertor convertor = new JsonSchemaConvertor(); Schema dmSchema = convertor.apply( Files.toString(new File(filePath), Charsets.UTF_8)); SchemaStringConverter converter = new SchemaStringConverter(); Schema rqSchema = converter.apply(dmSchema.toString()); Assert.assertEquals(dmSchema.getTableList().size(), rqSchema.getTableList().size()); }