@Test
public void test_FileSystem_DownloadAccessibleSystemFile_Works() throws Exception {

  // Prepare
  assert myFileSystem != null;
  assert myMockDevice != null;
  assert myCallbackExecutor != null;
  TestDevices.addEmulatorApi25Commands(myMockDevice.getShellCommands());
  DeviceFileEntry deviceEntry = waitForFuture(myFileSystem.getEntry("/system/build.prop"));
  myMockDevice.addRemoteFile(deviceEntry.getFullPath(), deviceEntry.getSize());
  Path tempFile = FileUtil.createTempFile("localFile", "tmp").toPath();
  // Act
  AtomicReference<Long> totalBytesRef = new AtomicReference<>();
  Void result = waitForFuture(deviceEntry.downloadFile(tempFile, new FileTransferProgress() {
    @Override
    public void progress(long currentBytes, long totalBytes) {
      totalBytesRef.set(totalBytes);
    }
    @Override
    public boolean isCancelled() {
      return false;
    }
  }));
  // Ensure all progress callbacks have been executed
  myCallbackExecutor.submit(EmptyRunnable.getInstance()).get(TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS);
  // Assert
  assertThat(result).isNull();
  assertThat(totalBytesRef.get()).isEqualTo(deviceEntry.getSize());
  assertThat(Files.exists(tempFile)).isTrue();
  assertThat(tempFile.toFile().length()).isEqualTo(deviceEntry.getSize());
}