RxFirebaseStorage { @CheckReturnValue @NonNull public static Completable delete(@NonNull final StorageReference ref) { return RxTask.completes(new Callable<Task<Void>>() { @Override public Task<Void> call() throws Exception { return ref.delete(); } }); } private  RxFirebaseStorage(); @CheckReturnValue @NonNull static Single<byte[]> getBytes(@NonNull final StorageReference ref,
                                          final long maxDownloadSizeBytes); @CheckReturnValue @NonNull static Completable delete(@NonNull final StorageReference ref); @CheckReturnValue @NonNull static Single<FileDownloadTask.TaskSnapshot> getFile(@NonNull final StorageReference ref,
                                                                @NonNull final Uri uri); @CheckReturnValue @NonNull static Single<FileDownloadTask.TaskSnapshot> getFile(@NonNull final StorageReference ref,
                                                                @NonNull final File file); @CheckReturnValue @NonNull static Single<StorageMetadata> getMetadata(@NonNull final StorageReference ref); @CheckReturnValue @NonNull static Single<StreamDownloadTask.TaskSnapshot> getStream(
            @NonNull final StorageReference ref); @CheckReturnValue @NonNull static Single<StreamDownloadTask.TaskSnapshot> getStream(
            @NonNull final StorageReference ref,
            @NonNull final StreamDownloadTask.StreamProcessor streamProcessor); @CheckReturnValue @NonNull static Single<Uri> getDownloadUrl(@NonNull final StorageReference ref); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference ref,
                                                           @NonNull final byte[] bytes); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putBytes(
            @NonNull final StorageReference ref,
            @NonNull final byte[] bytes,
            @NonNull final StorageMetadata storageMetadata); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putFile(@NonNull final StorageReference ref,
                                                          @NonNull final Uri uri); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putFile(
            @NonNull final StorageReference ref,
            @NonNull final Uri uri,
            @NonNull final StorageMetadata storageMetadata); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putFile(
            @NonNull final StorageReference ref,
            @NonNull final Uri uri,
            @Nullable final StorageMetadata storageMetadata,
            @Nullable final Uri existingUploadUri); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putStream(
            @NonNull final StorageReference ref,
            @NonNull final InputStream inputStream); @CheckReturnValue @NonNull static Single<UploadTask.TaskSnapshot> putStream(
            @NonNull final StorageReference ref,
            @NonNull final InputStream inputStream,
            @NonNull final StorageMetadata storageMetadata); @CheckReturnValue @NonNull static Single<StorageMetadata> updateMetadata(
            @NonNull final StorageReference ref,
            @NonNull final StorageMetadata storageMetadata);  }
@Test public void testDelete() { mockSuccessfulResultForTask(mockTask); Mockito.when(mockStorageReference.delete()).thenReturn(mockTask); TestObserver<byte[]> obs = TestObserver.create(); RxFirebaseStorage.delete(mockStorageReference).subscribe(obs); verifyAddOnCompleteListenerForTask(mockTask); callOnComplete(mockTask); obs.dispose(); callOnComplete(mockTask); obs.assertNoErrors(); obs.assertComplete(); }
@Test public void testDelete_notSuccessful() { mockNotSuccessfulResultForTask(mockTask, new IllegalStateException()); when(mockStorageReference.delete()).thenReturn(mockTask); TestObserver obs = TestObserver.create(); RxFirebaseStorage.delete(mockStorageReference).subscribe(obs); verifyAddOnCompleteListenerForTask(mockTask); callOnComplete(mockTask); obs.dispose(); callOnComplete(mockTask); obs.assertError(IllegalStateException.class); obs.assertNoValues(); }