use of nl.knaw.huygens.timbuctoo.server.GraphWrapper in project timbuctoo by HuygensING.
the class GraphLogValidatorTest method writeReportWritesALineForEachInvalidVertex.
@Test
public void writeReportWritesALineForEachInvalidVertex() throws Exception {
GraphWrapper wrapper = newGraph().withVertex(v -> v.withTimId(VERTEX_ID_1).withProperty("rev", 1).withLabel("document")).withVertex(v -> v.withTimId(VERTEX_ID_2).withProperty("rev", 1).withLabel("document")).withVertex(v -> v.withTimId(VERTEX_ID_1).withProperty("rev", 2).withLabel("document")).withVertex(v -> v.withTimId(VERTEX_ID_2).withProperty("rev", 2).withLabel("document")).withVertex(v -> v.withLabel("history").withOutgoingRelation("NEXT_ITEM", "v1")).withVertex("v1", v -> v.withProperty("TIM_tim_id", VERTEX_ID_1).withProperty("rev", 1).withLabel("createVertexEntry").withOutgoingRelation("NEXT_ITEM", "v2")).withVertex("v2", v -> v.withProperty("TIM_tim_id", VERTEX_ID_1).withProperty("rev", 2).withLabel("updateVertexEntry")).wrap();
GraphLogValidator graphLogValidator = new GraphLogValidator(wrapper);
Writer writer = mock(Writer.class);
graphLogValidator.writeReport(writer);
ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
verify(writer, times(2)).write(stringArgumentCaptor.capture());
assertThat(stringArgumentCaptor.getAllValues(), containsInAnyOrder(stringContainsInOrder(Lists.newArrayList("Vertex", VERTEX_ID_2, "2")), stringContainsInOrder(Lists.newArrayList("Vertex", VERTEX_ID_2, "1"))));
verifyNoMoreInteractions(writer);
}
Aggregations