DefaultGraphTemplateProducer implements GraphTemplateProducer { @Override public GraphTemplate get(Graph graph) { requireNonNull(graph, "graph is required"); SingleInstance<Graph> instance = new SingleInstance<>(graph); GraphConverter converter = new DefaultGraphConverter(classMappings, converters, instance); GraphWorkflow workflow = new DefaultGraphWorkflow(persistManager, converter); return new DefaultGraphTemplate(instance, classMappings, converter, workflow); }  @Override GraphTemplate get(Graph graph); @Override GraphTemplate get(GraphTraversalSourceSupplier supplier);  }
@Test public void shouldReturnErrorWhenManagerNull() { assertThrows(NullPointerException.class, () -> producer.get((Graph) null)); assertThrows(NullPointerException.class, () -> producer.get((GraphTraversalSourceSupplier) null)); }
@Test public void shouldReturnGraphTemplateWhenGetGraph() { Graph graph = Mockito.mock(Graph.class); GraphTemplate template = producer.get(graph); assertNotNull(template); }
@Test public void shouldReturnGraphTemplateWhenGetGraphTraversalSourceSupplier() { GraphTraversalSourceSupplier supplier = Mockito.mock(GraphTraversalSourceSupplier.class); GraphTemplate template = producer.get(supplier); assertNotNull(template); }