public static <T> T serializeDeserialize(final ObjectMapper mapper, final Object o, final Class<T> clazz) throws Exception {
        try (final ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
            mapper.writeValue(stream, o);
            try (final InputStream inputStream = new ByteArrayInputStream(stream.toByteArray())) {
                return mapper.readValue(inputStream, clazz);
            }
        }
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/AbstractGraphSONTest.java