@Test @Config(minSdk = M) public void isExternalStorageRemovable_primaryShouldReturnSavedValue() { assertThat(Environment.isExternalStorageRemovable()).isFalse(); ShadowEnvironment.setExternalStorageRemovable(Environment.getExternalStorageDirectory(), true); assertThat(Environment.isExternalStorageRemovable()).isTrue(); }
@Test @Config(minSdk = LOLLIPOP) public void isExternalStorageRemovable_shouldReturnSavedValue() { final File file = new File("/mnt/media/file"); assertThat(Environment.isExternalStorageRemovable(file)).isFalse(); ShadowEnvironment.setExternalStorageRemovable(file, true); assertThat(Environment.isExternalStorageRemovable(file)).isTrue(); }
@Test @Config(minSdk = LOLLIPOP) public void reset_shouldClearRemovableFiles() { final File file = new File("foo"); ShadowEnvironment.setExternalStorageRemovable(file, true); assertThat(Environment.isExternalStorageRemovable(file)).isTrue(); ShadowEnvironment.reset(); assertThat(Environment.isExternalStorageRemovable(file)).isFalse(); }