com.android.testutils
Class TestUtils

java.lang.Object
  extended by com.android.testutils.TestUtils

public class TestUtils
extends java.lang.Object

Utility methods to deal with loading the test data.


Constructor Summary
TestUtils()
           
 
Method Summary
static java.io.File createTempDirDeletedOnExit()
           
static void deleteFile(java.io.File dir)
           
static java.io.File getCanonicalRoot(java.lang.String... names)
          returns a File for the subfolder of the test resource data.
static java.io.File getRoot(java.lang.String... names)
          returns a File for the subfolder of the test resource data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestUtils

public TestUtils()
Method Detail

getRoot

public static java.io.File getRoot(java.lang.String... names)
returns a File for the subfolder of the test resource data. This is basically "src/test/resources/testData/$name". Note that this folder is relative to the root project which is where gradle sets the current working dir when running the tests. If you need a full folder path, use getCanonicalRoot(String...).

Parameters:
names - the names of the subfolders.
Returns:
a File

getCanonicalRoot

public static java.io.File getCanonicalRoot(java.lang.String... names)
                                     throws java.io.IOException
returns a File for the subfolder of the test resource data. The full path is canonized. This is basically ".../src/test/resources/testData/$name".

Parameters:
names - the names of the subfolders.
Returns:
a File
Throws:
java.io.IOException

deleteFile

public static void deleteFile(java.io.File dir)

createTempDirDeletedOnExit

public static java.io.File createTempDirDeletedOnExit()