use of org.icij.datashare.com.mail.MailSender in project datashare by ICIJ.
the class BatchDownloadRunnerEncryptedIntTest method test_zip_with_password_should_encrypt_file_and_send_mail.
@Test
public void test_zip_with_password_should_encrypt_file_and_send_mail() throws Exception {
new IndexerHelper(es.client).indexFile("mydoc.txt", "content", fs);
BatchDownload batchDownload = createBatchDownload("*");
MailSender mailSender = mock(MailSender.class);
new BatchDownloadRunner(indexer, createProvider(), batchDownload, updateCallback, (uri) -> mailSender).call();
assertThat(new net.lingala.zip4j.ZipFile(batchDownload.filename.toFile()).isEncrypted()).isTrue();
ArgumentCaptor<Mail> mailCaptor = ArgumentCaptor.forClass(Mail.class);
verify(mailSender).send(mailCaptor.capture());
assertThat(mailCaptor.getValue().from).isEqualTo("engineering@icij.org");
assertThat(mailCaptor.getValue().toRecipientList).containsExactly("foo@bar.com");
assertThat(mailCaptor.getValue().subject).isEqualTo("[datashare] " + batchDownload.filename.getFileName());
}
Aggregations