@Test public void testPutBytes_notSuccessful() { mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException()); when(mockStorageReference.putBytes(new byte[] { 1, 2, 3 })).thenReturn(mockUploadTask); TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create(); RxFirebaseStorage.putBytes(mockStorageReference, new byte[] { 1, 2, 3 }).subscribe(obs); verifyAddOnCompleteListenerForTask(mockUploadTask); callOnComplete(mockUploadTask); obs.dispose(); callOnComplete(mockUploadTask); obs.assertError(IllegalStateException.class); obs.assertNoValues(); }
@CheckReturnValue @NonNull public static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference ref, @NonNull final byte[] bytes) { return RxTask.single(new Callable<Task<UploadTask.TaskSnapshot>>() { @Override public Task<UploadTask.TaskSnapshot> call() throws Exception { return ref.putBytes(bytes); } }); }
RxFirebaseStorage { @CheckReturnValue @NonNull public static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference ref, @NonNull final byte[] bytes) { return RxTask.single(new Callable<Task<UploadTask.TaskSnapshot>>() { @Override public Task<UploadTask.TaskSnapshot> call() throws Exception { return ref.putBytes(bytes); } }); } }
RxFirebaseStorage { @CheckReturnValue @NonNull public static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference ref, @NonNull final byte[] bytes) { return RxTask.single(new Callable<Task<UploadTask.TaskSnapshot>>() { @Override public Task<UploadTask.TaskSnapshot> call() throws Exception { return ref.putBytes(bytes); } }); } private  RxFirebaseStorage(); }
RxFirebaseStorage { @CheckReturnValue @NonNull public static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference ref, @NonNull final byte[] bytes) { return RxTask.single(new Callable<Task<UploadTask.TaskSnapshot>>() { @Override public Task<UploadTask.TaskSnapshot> call() throws Exception { return ref.putBytes(bytes); } }); } 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); }
RxFirebaseStorage { @CheckReturnValue @NonNull public static Single<UploadTask.TaskSnapshot> putBytes(@NonNull final StorageReference ref, @NonNull final byte[] bytes) { return RxTask.single(new Callable<Task<UploadTask.TaskSnapshot>>() { @Override public Task<UploadTask.TaskSnapshot> call() throws Exception { return ref.putBytes(bytes); } }); } 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);  }