HttpConnectionReleaseDownloader extends AbstractReleaseDownloader { @VisibleForTesting static String[] requiredPermissions() { ArrayList<String> permissions = new ArrayList<>(); if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); } return permissions.toArray(new String[0]); } HttpConnectionReleaseDownloader(@NonNull Context context, @NonNull ReleaseDetails releaseDetails, @NonNull Listener listener); @Override synchronized boolean isDownloading(); @AnyThread @Override synchronized void resume(); @Override synchronized void cancel();  }
@Test public void requiredPermissionsForOldAndroidVersions() { Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.JELLY_BEAN); assertArrayEquals( new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, HttpConnectionReleaseDownloader.requiredPermissions()); }
@Test public void requiredPermissionsForKitKat() { Whitebox.setInternalState(Build.VERSION.class, "SDK_INT", Build.VERSION_CODES.KITKAT); assertArrayEquals(new String[0], HttpConnectionReleaseDownloader.requiredPermissions()); }