use of com.fsck.k9.notification.NotificationController in project k-9 by k9mail.
the class BaseNotificationsTest method createFakeController.
private NotificationController createFakeController() {
Builder builder = MockHelper.mockBuilder(Builder.class);
NotificationController controller = mock(NotificationController.class);
when(controller.createNotificationBuilder()).thenReturn(builder);
when(controller.getAccountName(any(Account.class))).thenReturn(ACCOUNT_NAME);
return controller;
}
use of com.fsck.k9.notification.NotificationController in project k-9 by k9mail.
the class MessagingControllerTest method sendPendingMessagesSynchronous_withAuthenticationFailure_shouldNotify.
@Test
public void sendPendingMessagesSynchronous_withAuthenticationFailure_shouldNotify() throws MessagingException {
setupAccountWithMessageToSend();
doThrow(new AuthenticationFailedException("Test")).when(transport).sendMessage(localMessageToSend1);
controller.sendPendingMessagesSynchronous(account);
verify(notificationController).showAuthenticationErrorNotification(account, false);
}
use of com.fsck.k9.notification.NotificationController in project k-9 by k9mail.
the class MessagingControllerTest method sendPendingMessagesSynchronous_withCertificateFailure_shouldNotify.
@Test
public void sendPendingMessagesSynchronous_withCertificateFailure_shouldNotify() throws MessagingException {
setupAccountWithMessageToSend();
doThrow(new CertificateValidationException("Test")).when(transport).sendMessage(localMessageToSend1);
controller.sendPendingMessagesSynchronous(account);
verify(notificationController).showCertificateErrorNotification(account, false);
}
use of com.fsck.k9.notification.NotificationController in project k-9 by k9mail.
the class DeviceNotificationsTest method createFakeNotificationController.
private NotificationController createFakeNotificationController(final Builder builder) {
Application context = RuntimeEnvironment.application;
NotificationController controller = mock(NotificationController.class);
when(controller.getContext()).thenReturn(context);
when(controller.getAccountName(any(Account.class))).thenReturn(ACCOUNT_NAME);
when(controller.createNotificationBuilder()).thenAnswer(new Answer<Builder>() {
private int invocationCount = 0;
@Override
public Builder answer(InvocationOnMock invocation) throws Throwable {
invocationCount++;
switch(invocationCount) {
case 1:
{
return builder;
}
case 2:
{
return builder2;
}
}
throw new AssertionError("createNotificationBuilder() invoked more than twice");
}
});
return controller;
}
use of com.fsck.k9.notification.NotificationController in project k-9 by k9mail.
the class LockScreenNotificationTest method setUp.
@Before
public void setUp() throws Exception {
Context context = RuntimeEnvironment.application;
builder = createFakeNotificationBuilder();
publicBuilder = createFakeNotificationBuilder();
NotificationController controller = createFakeController(context, publicBuilder);
Account account = createFakeAccount();
notificationData = createFakeNotificationData(account);
lockScreenNotification = new LockScreenNotification(controller);
}
Aggregations