EntitySeed extends ElementSeed implements EntityId { @Override public Object getVertex() { return vertex; } EntitySeed();  EntitySeed(final Object vertex); @Override Object getVertex(); @Override void setVertex(final Object vertex); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void shouldSerialiseAndDeserialiseIntegersAndLongs() throws SerialisationException { final Long vertex1 = 1L; final Integer vertex2 = 2; final EntityId seed1 = new EntitySeed(vertex1); final EntityId seed2 = new EntitySeed(vertex2); final byte[] bytes1 = JSONSerialiser.serialise(seed1); final byte[] bytes2 = JSONSerialiser.serialise(seed2); final EntityId seed1Deserialised = JSONSerialiser.deserialise(bytes1, EntityId.class); final EntityId seed2Deserialised = JSONSerialiser.deserialise(bytes2, EntityId.class); assertEquals(seed1, seed1Deserialised); assertEquals(seed2, seed2Deserialised); assertTrue(seed1Deserialised.getVertex() instanceof Long); assertTrue(seed2Deserialised.getVertex() instanceof Integer); }
@Test public void shouldSerialiseAndDeserialiseCustomVertexObjects() throws SerialisationException { final CustomVertex vertex = new CustomVertex(); vertex.setType("type"); vertex.setValue("value"); final EntityId seed = new EntitySeed(vertex); final byte[] bytes = JSONSerialiser.serialise(seed); final EntityId seedDeserialised = JSONSerialiser.deserialise(bytes, EntityId.class); assertTrue(seedDeserialised.getVertex() instanceof CustomVertex); assertEquals("type", ((CustomVertex) seedDeserialised.getVertex()).getType()); assertEquals("value", ((CustomVertex) seedDeserialised.getVertex()).getValue()); }