public class TestUtils
extends java.lang.Object
Constructor and Description |
---|
TestUtils() |
Modifier and Type | Method and Description |
---|---|
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.lang.String |
getDiff(java.lang.String[] before,
java.lang.String[] after) |
static java.lang.String |
getDiff(java.lang.String before,
java.lang.String after) |
static java.io.File |
getRoot(java.lang.String... names)
returns a File for the subfolder of the test resource data.
|
static java.io.File |
getSdkDir()
Returns the SDK directory as built from the Android source tree.
|
static void |
waitFilesystemTime()
Sleeps the current thread for enough time to ensure that we exceed filesystem timestamp
resolution.
|
@NonNull public static java.io.File getRoot(java.lang.String... names)
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...)
.
names
- the names of the subfolders.public static java.io.File getCanonicalRoot(java.lang.String... names) throws java.io.IOException
names
- the names of the subfolders.java.io.IOException
public static void deleteFile(java.io.File dir)
public static java.io.File createTempDirDeletedOnExit()
@NonNull public static java.io.File getSdkDir()
public static void waitFilesystemTime() throws java.lang.InterruptedException
java.lang.InterruptedException
- waiting interrupted@NonNull public static java.lang.String getDiff(@NonNull java.lang.String before, @NonNull java.lang.String after)
@NonNull public static java.lang.String getDiff(@NonNull java.lang.String[] before, @NonNull java.lang.String[] after)