FeatureSupport { public static Feature toFeature(String json) { try { Feature.Builder builder = Feature.newBuilder(); JsonFormat.parser().ignoringUnknownFields().merge(json, builder); return builder.build(); } catch (InvalidProtocolBufferException e) { throw new RuntimeException(e); } }  static Feature toFeature(String json);  }
@Test public void testToFeature() throws Exception { Feature feature = Feature.newBuilder() .setId("id1") .setKey("key1") .setGroup("app1") .setDescription("desc1") .setStatus(Status.off) .build(); final String json = JsonFormat.printer().print(feature); final Feature feature1 = FeatureSupport.toFeature(json); assertEquals(feature.getId(), feature1.getId()); assertEquals(feature.getKey(), feature1.getKey()); assertEquals(feature.getGroup(), feature1.getGroup()); assertEquals(feature.getDescription(), feature1.getDescription()); assertEquals(feature.getStatus(), feature1.getStatus()); }