private ByteArrayOutputStream testWriting(TestObject value, JsonFactory factory, Class<TestObject> clazz) throws IOException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    JsonGenerator g = factory.createGenerator(outputStream);
    JsonGeneratorWriter generatorWriter = new JsonGeneratorWriter(g);
    gson.toJson(value, clazz, generatorWriter);
    generatorWriter.flush();
    return outputStream;
  }
Test the various Jackson serialization formats against the Gson/Jackson bridge.
gson/test/org/immutables/gson/bridge/GsonJacksonBridgeSerializationTest.java