Search in sources :

Example 31 with MessageCryptoAnnotations

use of com.fsck.k9.mailstore.MessageCryptoAnnotations in project k-9 by k9mail.

the class MessageCryptoHelperTest method assertPartAnnotationHasState.

private void assertPartAnnotationHasState(Message message, MessageCryptoCallback messageCryptoCallback, CryptoError cryptoErrorState, MimeBodyPart replacementPart, OpenPgpDecryptionResult openPgpDecryptionResult, OpenPgpSignatureResult openPgpSignatureResult, PendingIntent openPgpPendingIntent) {
    ArgumentCaptor<MessageCryptoAnnotations> captor = ArgumentCaptor.forClass(MessageCryptoAnnotations.class);
    verify(messageCryptoCallback).onCryptoOperationsFinished(captor.capture());
    MessageCryptoAnnotations annotations = captor.getValue();
    CryptoResultAnnotation cryptoResultAnnotation = annotations.get(message);
    assertEquals(cryptoErrorState, cryptoResultAnnotation.getErrorType());
    if (replacementPart != null) {
        assertSame(replacementPart, cryptoResultAnnotation.getReplacementData());
    }
    assertSame(openPgpDecryptionResult, cryptoResultAnnotation.getOpenPgpDecryptionResult());
    assertSame(openPgpSignatureResult, cryptoResultAnnotation.getOpenPgpSignatureResult());
    assertSame(openPgpPendingIntent, cryptoResultAnnotation.getOpenPgpPendingIntent());
    verifyNoMoreInteractions(messageCryptoCallback);
}
Also used : CryptoResultAnnotation(com.fsck.k9.mailstore.CryptoResultAnnotation) MessageCryptoAnnotations(com.fsck.k9.mailstore.MessageCryptoAnnotations)

Aggregations

MimeMessage (com.fsck.k9.mail.internet.MimeMessage)22 Test (org.junit.Test)22 Message (com.fsck.k9.mail.Message)20 Part (com.fsck.k9.mail.Part)19 BodyPart (com.fsck.k9.mail.BodyPart)18 MimeBodyPart (com.fsck.k9.mail.internet.MimeBodyPart)12 K9RobolectricTest (com.fsck.k9.K9RobolectricTest)6 MessageCryptoAnnotations (com.fsck.k9.mailstore.MessageCryptoAnnotations)5 ArrayList (java.util.ArrayList)5 CryptoResultAnnotation (com.fsck.k9.mailstore.CryptoResultAnnotation)4 RobolectricTest (com.fsck.k9.RobolectricTest)2 Body (com.fsck.k9.mail.Body)2 Multipart (com.fsck.k9.mail.Multipart)2 Stack (java.util.Stack)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 Nullable (android.support.annotation.Nullable)1 WorkerThread (android.support.annotation.WorkerThread)1 WorkerThread (androidx.annotation.WorkerThread)1 MimeMultipart (com.fsck.k9.mail.internet.MimeMultipart)1