VertexWritable implements Writable, Serializable { public StarGraph.StarVertex get() { return this.vertex; } VertexWritable();  VertexWritable(final Vertex vertex); void set(final Vertex vertex); StarGraph.StarVertex get(); @Override void readFields(final DataInput input); @Override void write(final DataOutput output); @Override boolean equals(final Object other); @Override int hashCode(); @Override String toString();  }
@Test @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) public void shouldConstructVertexWritableWithCorrectByteRepresentation() { final StarGraph graph = StarGraph.open(); final Vertex v = graph.addVertex(T.id, 1, T.label, Vertex.DEFAULT_LABEL, "test", "123"); v.property(VertexProperty.Cardinality.list, "name", "marko", "acl", "private"); final VertexWritable vw = byteClone(new VertexWritable(v)); assertEquals(v.id(), vw.get().id()); assertEquals(v.label(), vw.get().label()); assertEquals("123", vw.get().value("test")); assertEquals(2, IteratorUtils.count(vw.get().properties())); assertEquals("marko", vw.get().value("name")); assertEquals("private", vw.get().property("name").value("acl")); }
@Test public void shouldHaveEqualVertexWritableAndInternalVertex() throws Exception { final StarGraph graph = StarGraph.open(); final Vertex v = graph.addVertex(T.id, 1, T.label, Vertex.DEFAULT_LABEL); final VertexWritable vw = new VertexWritable(v); assertEquals(vw, vw); assertEquals(vw, byteClone(vw)); assertEquals(v, byteClone(vw).get()); }