@Test void exportUserMailboxesDataShouldUpdateProgressWhenExporting() { doReturn(Mono.error(new RuntimeException())) .when(testSystem.blobStore) .save(any(), any(InputStream.class), any()); testee.export(progress, BOB, new ByteArrayInputStream(MESSAGE_CONTENT.getBytes())).block(); assertThat(progress.getStage()).isEqualTo(ExportService.Stage.EXPORTING); }
public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } @Inject  ExportService(MailboxBackup mailboxBackup, BlobStore blobStore, BlobExportMechanism blobExport, UsersRepository usersRepository); }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } @Inject  ExportService(MailboxBackup mailboxBackup, BlobStore blobStore, BlobExportMechanism blobExport, UsersRepository usersRepository); Mono<Task.Result> export(Progress progress, Username username); }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } @Inject  ExportService(MailboxBackup mailboxBackup, BlobStore blobStore, BlobExportMechanism blobExport, UsersRepository usersRepository); Mono<Task.Result> export(Progress progress, Username username);  }