You can write an assistant around this call and easily make fun of it after (sorry for the presence of an auxiliary part in the class name):
public class EnvironmentHelper { public String getStorageState() { return Environment.getExternalStorateState(); } }
Or, if you use Robolectric , you can call:
ShadowEnvironment.setExternalStorageState(Environment.MEDIA_MOUNTED);
It depends on your settings and needs, but I would recommend investing in Robolectric using
source share