@Test
  public void xmlFactoryTest() throws IOException {
    TestObject value = createTestObject();
    XmlFactory factory = new XmlFactory();
    Class<TestObject> clazz = TestObject.class;
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    ToXmlGenerator g = factory.createGenerator(outputStream);
    g.setNextName(QName.valueOf(clazz.getAnnotation(JacksonXmlRootElement.class).localName()));
    JsonGeneratorWriter generatorWriter = new JsonGeneratorWriter(g);
    gson.toJson(value, clazz, generatorWriter);
    generatorWriter.flush();
    TestObject value2 = testXmlReading(factory, clazz, outputStream);
    Assert.assertEquals(value2.toString(), value.toString());
  }
Test the various Jackson serialization formats against the Gson/Jackson bridge.
gson/test/org/immutables/gson/bridge/GsonJacksonBridgeSerializationTest.java