Java ClassLoader Load getTestDir(final String name)

Here you can find the source of getTestDir(final String name)

Description

get Test Dir

License

Open Source License

Declaration

public static File getTestDir(final String name) throws IOException, URISyntaxException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.IOException;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class Main {
    public static File getTestDir(final String name) throws IOException, URISyntaxException {
        ClassLoader cloader = Thread.currentThread().getContextClassLoader();
        URL resource = cloader.getResource(name);

        if (resource == null) {
            throw new IOException("Cannot find test directory: " + name);
        }/*from   w w  w.  j a v a2 s  .  c  o  m*/

        return new File(new URI(resource.toExternalForm()).normalize().getPath());
    }
}

Related

  1. getSourcesPath()
  2. getSSTable(String version, int generation)
  3. getStream(final File file)
  4. getStreamForString(String source)
  5. getSystemPath(String inPath)
  6. getTestJson()
  7. getTomcatBinaryDistribution()
  8. getVolFile(String fileName)