@Before
    public void setup() throws Exception {
        final Method testMethod = this.getClass().getMethod(cleanMethodName(name.getMethodName()));
        final LoadGraphWith[] loadGraphWiths = testMethod.getAnnotationsByType(LoadGraphWith.class);
        final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
        final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();
        final Set<FeatureRequirement> featureRequirementSet = getFeatureRequirementsForTest(testMethod, loadGraphWiths);

        graphProvider = GraphManager.getGraphProvider();

        // pre-check if available from graph provider to avoid graph creation
        final Optional<Graph.Features> staticFeatures = graphProvider.getStaticFeatures();
        if (staticFeatures.isPresent()) {
            assumeRequirementsAreMetForTest(featureRequirementSet, staticFeatures.get(), true);
        }

        graphProvider.getTestListener().ifPresent(l -> l.onTestStart(this.getClass(), name.getMethodName()));

        // Reset the counter for open iterators by this test
        StoreIteratorCounter.INSTANCE.reset();

        config = graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName(), loadGraphWithData);

        // this should clear state from a previously unfinished test. since the graph does not yet exist,
        // persisted graphs will likely just have their directories removed
        graphProvider.clear(config);

        graph = graphProvider.openTestGraph(config);
        g = graphProvider.traversal(graph);

        // even if we checked static features earlier it's of little cost to recheck again with the real graph
        // once it is instantiated. the real cost savings is preventing graph creation in the first place so
        // let's double check that all is legit.
        assumeRequirementsAreMetForTest(featureRequirementSet, graph.features(), false);

        beforeLoadGraphWith(graph);

        // load a graph with sample data if the annotation is present on the test
        graphProvider.loadGraphData(graph, loadGraphWith, this.getClass(), name.getMethodName());

        afterLoadGraphWith(graph);
    }
Sets up g based on the current graph configuration and checks required features for the test.

@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java