Class ShadowEnvironment

    • Constructor Detail

      • ShadowEnvironment

        public ShadowEnvironment()
    • Method Detail

      • setExternalStorageDirectory

        public static void setExternalStorageDirectory​(Path directory)
        Sets the return value of getExternalStorageDirectory(). Note that the default value provides a directory that is usable in the test environment. If the test app uses this method to override that default directory, please clean up any files written to that directory, as the Robolectric environment will not purge that directory when the test ends.
        directory - Path to return from getExternalStorageDirectory().
      • getExternalStorageDirectory

        protected static File getExternalStorageDirectory()
      • getExternalStoragePublicDirectory

        protected static File getExternalStoragePublicDirectory​(String type)
      • reset

        public static void reset()
      • isExternalStorageRemovable

        protected static boolean isExternalStorageRemovable()
      • isExternalStorageEmulated

        protected static boolean isExternalStorageEmulated()
      • isExternalStorageLegacy

        protected static boolean isExternalStorageLegacy()
      • setExternalStorageRemovable

        public static void setExternalStorageRemovable​(File file,
                                                       boolean isRemovable)
        Sets the "isRemovable" flag of a particular file.
        file - Target file.
        isRemovable - True if the filesystem is removable.
      • setExternalStorageEmulated

        public static void setExternalStorageEmulated​(File file,
                                                      boolean isEmulated)
        Sets the "isEmulated" flag of a particular file.
        file - Target file.
        isEmulated - True if the filesystem is emulated.