use of com.fsck.k9.Account in project k-9 by k9mail.
the class SyncNotificationsTest method testGetFetchingMailNotificationId.
@Test
public void testGetFetchingMailNotificationId() throws Exception {
Folder folder = createFakeFolder();
int notificationId = NotificationIds.getFetchingMailNotificationId(account);
syncNotifications.showFetchingMailNotification(account, folder);
verify(notificationManager).notify(eq(notificationId), any(Notification.class));
verify(builder).setSmallIcon(R.drawable.ic_notify_check_mail);
verify(builder).setTicker("Checking mail: " + ACCOUNT_NAME + ":" + FOLDER_NAME);
verify(builder).setContentTitle("Checking mail");
verify(builder).setContentText(ACCOUNT_NAME + ":" + FOLDER_NAME);
verify(builder).setContentIntent(contentIntent);
verify(builder).setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class NewMailNotificationsTest method testRemoveNewMailNotificationWithoutNotificationData.
@Test
public void testRemoveNewMailNotificationWithoutNotificationData() throws Exception {
MessageReference messageReference = createMessageReference(1);
newMailNotifications.removeNewMailNotification(account, messageReference);
verify(notificationManager, never()).cancel(anyInt());
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class NewMailNotificationsTest method testRemoveNewMailNotification.
@Test
public void testRemoveNewMailNotification() throws Exception {
enablePrivacyMode();
MessageReference messageReference = createMessageReference(1);
int notificationIndex = 0;
int notificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex);
LocalMessage message = createLocalMessage();
NotificationContent content = createNotificationContent();
NotificationHolder holder = createNotificationHolder(content, notificationIndex);
addToNotificationContentCreator(message, content);
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder));
Notification summaryNotification = createNotification();
addToDeviceNotifications(summaryNotification);
newMailNotifications.addNewMailNotification(account, message, 23);
whenRemovingContentReturn(messageReference, RemoveNotificationResult.cancelNotification(notificationId));
newMailNotifications.removeNewMailNotification(account, messageReference);
int summaryNotificationId = NotificationIds.getNewMailSummaryNotificationId(account);
verify(notificationManager).cancel(notificationId);
verify(notificationManager, times(2)).notify(summaryNotificationId, summaryNotification);
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class NewMailNotificationsTest method testAddNewMailNotificationWithCancelingExistingNotification.
@Test
public void testAddNewMailNotificationWithCancelingExistingNotification() throws Exception {
int notificationIndex = 0;
LocalMessage message = createLocalMessage();
NotificationContent content = createNotificationContent();
NotificationHolder holder = createNotificationHolder(content, notificationIndex);
addToNotificationContentCreator(message, content);
whenAddingContentReturn(content, AddNotificationResult.replaceNotification(holder));
Notification wearNotification = createNotification();
Notification summaryNotification = createNotification();
addToWearNotifications(holder, wearNotification);
addToDeviceNotifications(summaryNotification);
newMailNotifications.addNewMailNotification(account, message, 42);
int wearNotificationId = NotificationIds.getNewMailStackedNotificationId(account, notificationIndex);
int summaryNotificationId = NotificationIds.getNewMailSummaryNotificationId(account);
verify(notificationManager).notify(wearNotificationId, wearNotification);
verify(notificationManager).cancel(wearNotificationId);
verify(notificationManager).notify(summaryNotificationId, summaryNotification);
}
use of com.fsck.k9.Account in project k-9 by k9mail.
the class NewMailNotificationsTest method createAccount.
private Account createAccount() {
Account account = mock(Account.class);
when(account.getAccountNumber()).thenReturn(ACCOUNT_NUMBER);
return account;
}
Aggregations