package com.tinkerpop.gremlin.structure;

import com.tinkerpop.gremlin.AbstractGremlinTest;
import com.tinkerpop.gremlin.structure.strategy.GraphStrategy;
import com.tinkerpop.gremlin.structure.util.GraphFactory;
import org.apache.commons.configuration.Configuration;
import org.junit.Test;

import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Optional;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
 * Tests that support the creation of {@link com.tinkerpop.gremlin.structure.Graph} instances which occurs via {@link com.tinkerpop.gremlin.structure.util.GraphFactory}.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class GraphConstructionTest extends AbstractGremlinTest {
    /**
     * All Blueprints implementations should be constructable through {@link com.tinkerpop.gremlin.structure.util.GraphFactory}.
     */
    @Test
    public void shouldOpenGraphThroughGraphFactoryViaApacheConfig() throws Exception {
        final Graph expectedGraph = g;
        final Configuration c  = graphProvider.newGraphConfiguration("temp");
        final Graph createdGraph = GraphFactory.open(c, Optional.<GraphStrategy>empty());

        assertNotNull(createdGraph);
        assertEquals(expectedGraph.getClass(), createdGraph.getClass());

        graphProvider.clear(g, c);
    }

    /**
     * Blueprints implementations should have private constructor as all graphs.  They should be only instantiated
     * through the GraphFactory or the static open() method on the Graph implementation itself.
     */
    @Test
    public void shouldHavePrivateConstructor() {
        assertTrue(Arrays.asList(g.getClass().getConstructors()).stream().allMatch(c -> {
            final int modifier = c.getModifiers();
            return Modifier.isPrivate(modifier) || Modifier.isPrivate(modifier);
        }));
    }

    /**
     * Graphs should be empty on creation.
     */
    @Test
    public void shouldConstructAnEmptyGraph() {
        StructureStandardSuite.assertVertexEdgeCounts(0, 0).accept(g);
    }
}

@@ -622,16 +622,19 @@
 curs via
+%0A *
  %7B@link 
@@ -685,16 +685,16 @@
 ctory%7D.%0A
-
  *%0A * @a
@@ -835,26 +835,33 @@
   * All 
-Blueprints
+Gremlin Structure
  impleme
@@ -900,16 +900,23 @@
  through
+%0A     *
  %7B@link 
@@ -1452,18 +1452,26 @@
   * 
-Blueprints
+Gremlin Structure 
  imp
@@ -1550,16 +1550,23 @@
  be only
+%0A     *
  instant
@@ -1570,23 +1570,16 @@
 antiated
-%0A     *
  through
@@ -1579,24 +1579,68 @@
 through the 
+%7B@link com.tinkerpop.gremlin.structure.util.
 GraphFactory
@@ -1639,16 +1639,17 @@
 hFactory
+%7D
  or the 
@@ -1658,15 +1658,133 @@
 atic
- open()
+%0A     * %7B@link com.tinkerpop.gremlin.structure.util.GraphFactory#open(org.apache.commons.configuration.Configuration)%7D%0A     *
  met

Fix javadoc in graph construction tests.