@Test
        @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
        public void shouldSerializeTraversalMetrics() throws Exception {
            final ObjectMapper mapper = graph.io(GraphSONIo.build(GraphSONVersion.V3_0)).mapper().version(GraphSONVersion.V3_0).create().createMapper();
            final TraversalMetrics before = g.V().both().profile().next();
            final String json = mapper.writeValueAsString(before);
            final TraversalMetrics after = mapper.readValue(json, TraversalMetrics.class);

            assertNotNull(after);
            assertEquals(before.getMetrics().size(), after.getMetrics().size());
            assertEquals(before.getDuration(TimeUnit.MILLISECONDS), after.getDuration(TimeUnit.MILLISECONDS));
            assertEquals(before.getMetrics().size(), after.getMetrics().size());

            before.getMetrics().forEach(b -> {
                final Optional<? extends Metrics> mFromA = after.getMetrics().stream().filter(a -> b.getId().equals(a.getId())).findFirst();
                if (mFromA.isPresent()) {
                    final Metrics m = mFromA.get();
                    assertEquals(b.getAnnotations(), m.getAnnotations());
                    assertEquals(b.getCounts(), m.getCounts());
                    assertEquals(b.getName(), m.getName());
                    assertEquals(b.getDuration(TimeUnit.MILLISECONDS), m.getDuration(TimeUnit.MILLISECONDS));
                } else {
                    fail("Metrics were not present after deserialization");
                }
            });
        }
Serialization tests that occur at a lower level than IO.  Note that there is no need to test GraphML here as
it is not a format that can be used for generalized serialization (i.e. it only serializes an entire graph).

@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java