### Question:
MultiPointOutputStream { void inspectFreeSpace(StatFs statFs, long requireSpace) throws PreAllocateException { final long freeSpace = Util.getFreeSpaceBytes(statFs); if (freeSpace < requireSpace) { throw new PreAllocateException(requireSpace, freeSpace); } } MultiPointOutputStream(@NonNull final DownloadTask task,
                           @NonNull BreakpointInfo info,
                           @NonNull DownloadStore store,
                           @Nullable Runnable syncRunnable);  MultiPointOutputStream(@NonNull DownloadTask task,
                                  @NonNull BreakpointInfo info,
                                  @NonNull DownloadStore store); synchronized void write(int blockIndex, byte[] bytes, int length); void cancelAsync(); synchronized void cancel(); void done(int blockIndex); void inspectComplete(int blockIndex); void setRequireStreamBlocks(List<Integer> requireStreamBlocks); void catchBlockConnectException(int blockIndex);  }### Answer:
@Test public void inspectFreeSpace_freeSpaceNotEnough() throws PreAllocateException { final StatFs statFs = mock(StatFs.class); when(statFs.getAvailableBlocks()).thenReturn(1); when(statFs.getBlockSize()).thenReturn(2); thrown.expectMessage("There is Free space less than Require space: 2 < 3"); thrown.expect(PreAllocateException.class); multiPointOutputStream.inspectFreeSpace(statFs, 3); }
@Test public void inspectFreeSpace() throws PreAllocateException { final StatFs statFs = mock(StatFs.class); when(statFs.getAvailableBlocks()).thenReturn(1); when(statFs.getBlockSize()).thenReturn(2); multiPointOutputStream.inspectFreeSpace(statFs, 2); }