ContentSupport { byte[] toJsonBytes(Message message) { try { String json = JsonFormat.printer().preservingProtoFieldNames().print(message); return json.getBytes(StandardCharsets.UTF_8); } catch (Exception e) { throw new FeatureException(Problem.localProblem(e.getMessage(), ""), e); } }    }
@Test public void testToJsonBytes() throws Exception { final Feature in = TestSupport.loadFeature("json/feature-1.json"); final ContentSupport cs = new ContentSupport(); final byte[] bytes = cs.toJsonBytes(in); final String raw = new String(bytes, "UTF-8"); final Feature feature = new FeatureSupport().toFeature(raw); assertEquals(in, feature); }