@Test public void createForVertexCreatesAnUpdateVertexLogEntryIfTheVertexHasIncomingVersionOfEdges() { Vertex vertex = vertex().withIncomingRelation("VERSION_OF", vertex().build()).build(); LogEntryFactory instance = new LogEntryFactory(); LogEntry entry = instance.createForVertex(vertex); assertThat(entry, is(instanceOf(UpdateVertexLogEntry.class))); }
public LogEntry createForVertex(Vertex vertex) { Iterator<Vertex> previous = vertex.vertices(Direction.IN, "VERSION_OF"); if (previous.hasNext()) { return new UpdateVertexLogEntry(vertex, previous.next()); } return new CreateVertexLogEntry(vertex); }
LogEntryFactory { public LogEntry createForVertex(Vertex vertex) { Iterator<Vertex> previous = vertex.vertices(Direction.IN, "VERSION_OF"); if (previous.hasNext()) { return new UpdateVertexLogEntry(vertex, previous.next()); } return new CreateVertexLogEntry(vertex); } }
LogEntryFactory { public LogEntry createForVertex(Vertex vertex) { Iterator<Vertex> previous = vertex.vertices(Direction.IN, "VERSION_OF"); if (previous.hasNext()) { return new UpdateVertexLogEntry(vertex, previous.next()); } return new CreateVertexLogEntry(vertex); } LogEntryFactory(); }
LogEntryFactory { public LogEntry createForVertex(Vertex vertex) { Iterator<Vertex> previous = vertex.vertices(Direction.IN, "VERSION_OF"); if (previous.hasNext()) { return new UpdateVertexLogEntry(vertex, previous.next()); } return new CreateVertexLogEntry(vertex); } LogEntryFactory(); LogEntry createForVertex(Vertex vertex); LogEntry createForEdge(Edge edge); }
LogEntryFactory { public LogEntry createForVertex(Vertex vertex) { Iterator<Vertex> previous = vertex.vertices(Direction.IN, "VERSION_OF"); if (previous.hasNext()) { return new UpdateVertexLogEntry(vertex, previous.next()); } return new CreateVertexLogEntry(vertex); } LogEntryFactory(); LogEntry createForVertex(Vertex vertex); LogEntry createForEdge(Edge edge);  }