Code example for File

Methods: getParent

0
    } 
    public static void setDefaultLoader(Loader robolectricClassLoader) {
    	//used by the RoboSpecs project to allow for mixed scala\java tests to be run with Maven Surefire (see the RoboSpecs project on github) 
        if (defaultLoader == null) {
            defaultLoader = (RobolectricClassLoader)robolectricClassLoader;
        } else throw new RuntimeException("You may not set the default robolectricClassLoader unless it is null!");
    } 
    /** 
     * Creates a runner to run {@code testClass}. Looks in your working directory for your AndroidManifest.xml file 
     * and res directory. 
     * 
     * @param testClass the test class to be run 
     * @throws InitializationError if junit says so 
     */ 
    public RobolectricTestRunner(final Class<?> testClass) throws InitializationError {
        this(testClass, new RobolectricConfig(new File(".")));
    } 
 
    /** 
     * Call this constructor in subclasses in order to specify non-default configuration (e.g. location of the 
     * AndroidManifest.xml file and resource directory). 
     * 
     * @param testClass         the test class to be run 
     * @param robolectricConfig the configuration data 
     * @throws InitializationError if junit says so 
     */ 
    protected RobolectricTestRunner(final Class<?> testClass, final RobolectricConfig robolectricConfig)
            throws InitializationError { 
        this(testClass,
                isInstrumented() ? null : ShadowWrangler.getInstance(), 
                isInstrumented() ? null : getDefaultLoader(), 
                robolectricConfig,new H2Map());
    } 
     
    /** 
     * Call this constructor in subclasses in order to specify non-default configuration (e.g. location of the 
     * AndroidManifest.xml file, resource directory, and DatabaseMap). 
     * 
     * @param testClass         the test class to be run 
     * @param robolectricConfig the configuration data 
     * @param databaseMap		the database mapping 
     * @throws InitializationError if junit says so 
     */ 
    protected RobolectricTestRunner(Class<?> testClass, RobolectricConfig robolectricConfig, DatabaseMap databaseMap)
            throws InitializationError { 
        this(testClass,
                isInstrumented() ? null : ShadowWrangler.getInstance(), 
                isInstrumented() ? null : getDefaultLoader(), 
                robolectricConfig, databaseMap);
    } 
 
    /** 
     * Call this constructor in subclasses in order to specify the project root directory. 
     * 
     * @param testClass          the test class to be run 
     * @param androidProjectRoot the directory containing your AndroidManifest.xml file and res dir 
     * @throws InitializationError if the test class is malformed 
     */ 
    public RobolectricTestRunner(final Class<?> testClass, final File androidProjectRoot) throws InitializationError {
        this(testClass, new RobolectricConfig(androidProjectRoot));
    } 
 
    /** 
     * Call this constructor in subclasses in order to specify the project root directory. 
     * 
     * @param testClass          the test class to be run 
     * @param androidProjectRoot the directory containing your AndroidManifest.xml file and res dir 
     * @throws InitializationError if junit says so 
     * @deprecated Use {@link #RobolectricTestRunner(Class, File)} instead. 
     */ 
    @Deprecated 
    public RobolectricTestRunner(final Class<?> testClass, final String androidProjectRoot) throws InitializationError {
        this(testClass, new RobolectricConfig(new File(androidProjectRoot)));
    } 
 
    /** 
     * Call this constructor in subclasses in order to specify the location of the AndroidManifest.xml file and the 
     * resource directory. The #androidManifestPath is used to locate the AndroidManifest.xml file which, in turn, 
     * contains package name for the {@code R} class which contains the identifiers for all of the resources. The 
     * resource directory is where the resource loader will look for resources to load. 
     * 
     * @param testClass           the test class to be run 
     * @param androidManifestPath the AndroidManifest.xml file 
     * @param resourceDirectory   the directory containing the project's resources 
     * @throws InitializationError if junit says so 
     */ 
    protected RobolectricTestRunner(final Class<?> testClass, final File androidManifestPath, final File resourceDirectory)
            throws InitializationError { 
        this(testClass, new RobolectricConfig(androidManifestPath, resourceDirectory));
    } 
 
    /** 
     * Call this constructor in subclasses in order to specify the location of the AndroidManifest.xml file and the 
     * resource directory. The #androidManifestPath is used to locate the AndroidManifest.xml file which, in turn, 
     * contains package name for the {@code R} class which contains the identifiers for all of the resources. The 
     * resource directory is where the resource loader will look for resources to load. 
     * 
     * @param testClass           the test class to be run 
     * @param androidManifestPath the relative path to the AndroidManifest.xml file 
     * @param resourceDirectory   the relative path to the directory containing the project's resources 
     * @throws InitializationError if junit says so 
     * @deprecated Use {@link #RobolectricTestRunner(Class, File, File)} instead. 
     */ 
    @Deprecated 
    protected RobolectricTestRunner(final Class<?> testClass, final String androidManifestPath, final String resourceDirectory)
            throws InitializationError { 
        this(testClass, new RobolectricConfig(new File(androidManifestPath), new File(resourceDirectory)));
    } 
 
    protected RobolectricTestRunner(Class<?> testClass, ClassHandler classHandler, RobolectricClassLoader classLoader, RobolectricConfig robolectricConfig) throws InitializationError {
    	this(testClass, classHandler, classLoader, robolectricConfig,new H2Map());	
    }