@TargetApi(Build.VERSION_CODES.N)
  public static File getVolumeDirectory(StorageVolume volume) {
    try {
      Field f = StorageVolume.class.getDeclaredField("mPath");
      f.setAccessible(true);
      return (File) f.get(volume);
    } catch (Exception e) {
      // This shouldn't fail, as mPath has been there in every version
      throw new RuntimeException(e);
    }
  }
@Test
  @Config(sdk = {P}) // min sdk is N
  public void testGetVolumeDirectory() throws Exception {
    StorageVolume mock = mock(StorageVolume.class);
    Field f = StorageVolume.class.getDeclaredField("mPath");
    f.setAccessible(true);
    f.set(mock, new File("/storage/emulated/0"));

    File result = Utils.getVolumeDirectory(mock);
    assertNotNull(result);
    assertEquals(new File("/storage/emulated/0"), result);
  }