DeleteFilesRule
Artifact: androidx.test.ext:junit
public final class DeleteFilesRule implements TestRule
Deletes files recursively in Android storage directories after each test.
This ensures that each test case has a clean slate in terms of the file system, such that files created in one test don't impact any other test.
Files that are present at the start of the test are not deleted at the end.
Directories that are impacted are
context.getApplicationInfo().dataDir
getExternalStorageDirectory
getDownloadCacheDirectory
getExternalCacheDir
getNoBackupFilesDir
(Android 21+)context.getApplicationInfo().deviceProtectedDataDir
(Android 24+)
Summary
Public constructors |
---|
Public methods |
|
---|---|
Statement |
apply(Statement base, Description description) |