use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingControllerTest method listFoldersSynchronous_shouldNotNotifyFinishedAfterFailure.
@Test
public void listFoldersSynchronous_shouldNotNotifyFinishedAfterFailure() throws MessagingException {
when(localStore.getPersonalNamespaces(false)).thenThrow(new MessagingException("Test"));
controller.listFoldersSynchronous(account, true, listener);
verify(listener, never()).listFoldersFinished(account);
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessageCryptoHelper method extractClearsignedTextReplacementPart.
private static MimeBodyPart extractClearsignedTextReplacementPart(Part part) {
try {
String clearsignedText = MessageExtractor.getTextFromPart(part);
String replacementText = OpenPgpUtils.extractClearsignedMessage(clearsignedText);
if (replacementText == null) {
Timber.e("failed to extract clearsigned text for replacement part");
return NO_REPLACEMENT_PART;
}
return new MimeBodyPart(new TextBody(replacementText), "text/plain");
} catch (MessagingException e) {
Timber.e(e, "failed to create clearsigned text replacement part");
return NO_REPLACEMENT_PART;
}
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingControllerTest method clearFolderSynchronous_whenStorageUnavailable_shouldThrowUnavailableAccountException.
@Test(expected = UnavailableAccountException.class)
public void clearFolderSynchronous_whenStorageUnavailable_shouldThrowUnavailableAccountException() throws MessagingException {
doThrow(new UnavailableStorageException("Test")).when(localFolder).open(Folder.OPEN_MODE_RW);
controller.clearFolderSynchronous(account, FOLDER_NAME, listener);
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingControllerTest method refreshRemoteSynchronous_shouldCreateFoldersFromRemote.
@Test
public void refreshRemoteSynchronous_shouldCreateFoldersFromRemote() throws MessagingException {
configureRemoteStoreWithFolder();
LocalFolder newLocalFolder = mock(LocalFolder.class);
List<Folder> folders = Collections.singletonList(remoteFolder);
when(remoteStore.getPersonalNamespaces(false)).thenAnswer(createAnswer(folders));
when(remoteFolder.getName()).thenReturn("NewFolder");
when(localStore.getFolder("NewFolder")).thenReturn(newLocalFolder);
controller.refreshRemoteSynchronous(account, listener);
verify(localStore).createFolders(eq(Collections.singletonList(newLocalFolder)), anyInt());
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingControllerTest method refreshRemoteSynchronous_shouldDeleteFoldersNotOnRemote.
@Test
public void refreshRemoteSynchronous_shouldDeleteFoldersNotOnRemote() throws MessagingException {
configureRemoteStoreWithFolder();
LocalFolder oldLocalFolder = mock(LocalFolder.class);
when(oldLocalFolder.getName()).thenReturn("OldLocalFolder");
when(localStore.getPersonalNamespaces(false)).thenReturn(Collections.singletonList(oldLocalFolder));
List<Folder> folders = Collections.emptyList();
when(remoteStore.getPersonalNamespaces(false)).thenAnswer(createAnswer(folders));
controller.refreshRemoteSynchronous(account, listener);
verify(oldLocalFolder).delete(false);
}
Aggregations