public static File getRootOfBuildDirectory(final Class<?> clazz) {
        final File root;

        // build.dir gets sets during runs of tests with maven via the surefire configuration in the pom.xml
        // if that is not set as an environment variable, then the path is computed based on the location of the
        // requested class.  the computed version at least as far as intellij is concerned comes drops it into
        // /target/test-classes.  the build.dir had to be added because maven doesn't seem to like a computed path
        // as it likes to find that path in the .m2 directory and other weird places......
        final String buildDirectory = System.getProperty("build.dir");

        if (null == buildDirectory) {
            final String clsUri = clazz.getName().replace(".", "/") + ".class";
            final URL url = clazz.getClassLoader().getResource(clsUri);
            final String clsPath = url.getPath();
            final String computePath = clsPath.substring(0, clsPath.length() - clsUri.length());

            root = new File(computePath).getParentFile();
        } else {
            root = new File(buildDirectory);
        }
        if (!root.exists())
            root.mkdirs();
        return root;
    }
Gets and/or creates the root of the test data directory.  This  method is here as a convenience and should not
be used to store test data.  Use {@link #makeTestDataPath(Class, String...)} instead.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TestSupport.java