### Question:
DownloadUriOutputStream implements DownloadOutputStream { @Override public void setLength(long newLength) { final String tag = "DownloadUriOutputStream"; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { try { Os.posix_fallocate(pdf.getFileDescriptor(), 0, newLength); } catch (Throwable e) { if (e instanceof ErrnoException) { if (((ErrnoException) e).errno == OsConstants.ENOSYS || ((ErrnoException) e).errno == OsConstants.ENOTSUP) { Util.w(tag, "fallocate() not supported; falling back to ftruncate()"); try { Os.ftruncate(pdf.getFileDescriptor(), newLength); } catch (Throwable e1) { Util.w(tag, "It can't pre-allocate length(" + newLength + ") on the sdk" + " version(" + Build.VERSION.SDK_INT + "), because of " + e1); } } } else { Util.w(tag, "It can't pre-allocate length(" + newLength + ") on the sdk" + " version(" + Build.VERSION.SDK_INT + "), because of " + e); } } } else { Util.w(tag, "It can't pre-allocate length(" + newLength + ") on the sdk " + "version(" + Build.VERSION.SDK_INT + ")"); } } DownloadUriOutputStream(Context context, Uri uri, int bufferSize);   DownloadUriOutputStream(@NonNull FileChannel channel, @NonNull ParcelFileDescriptor pdf,
                            @NonNull FileOutputStream fos,
                            @NonNull BufferedOutputStream out); @Override void write(byte[] b, int off, int len); @Override void close(); @Override void flushAndSync(); @Override void seek(long offset); @Override void setLength(long newLength);  }### Answer:
@Test public void setLength() { outputStream.setLength(1); verify(pdf).getFileDescriptor(); }