private Folder createFakeFolder() { Folder folder = mock(Folder.class); when(folder.getServerId()).thenReturn(FOLDER_SERVER_ID); when(folder.getName()).thenReturn(FOLDER_NAME); return folder; } }
public void showFetchingMailNotification(Account account, Folder folder) { String accountName = account.getDescription(); String folderServerId = folder.getServerId(); String folderName = folder.getName(); String tickerText = resourceProvider.checkingMailTicker(accountName, folderName); String title = resourceProvider.checkingMailTitle(); //TODO: Use format string from resources String text = accountName + resourceProvider.checkingMailSeparator() + folderName; int notificationId = NotificationIds.getFetchingMailNotificationId(account); PendingIntent showMessageListPendingIntent = actionBuilder.createViewFolderPendingIntent( account, folderServerId, notificationId); NotificationCompat.Builder builder = notificationHelper.createNotificationBuilder(account, NotificationChannelManager.ChannelType.MISCELLANEOUS) .setSmallIcon(resourceProvider.getIconCheckingMail()) .setWhen(System.currentTimeMillis()) .setOngoing(true) .setTicker(tickerText) .setContentTitle(title) .setContentText(text) .setContentIntent(showMessageListPendingIntent) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setCategory(NotificationCompat.CATEGORY_SERVICE); if (NOTIFICATION_LED_WHILE_SYNCING) { notificationHelper.configureNotification(builder, null, null, account.getNotificationSetting().getLedColor(), NOTIFICATION_LED_BLINK_FAST, true); } getNotificationManager().notify(notificationId, builder.build()); }
@Test public void getPersonalNamespaces_shouldSetSpecialFolderNames() throws Exception { configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(), createOkSearchResponse()); List<? extends Folder> folders = webDavStore.getPersonalNamespaces(); Map<String, FolderType> folderNameToTypeMap = new HashMap<>(); for (Folder folder : folders) { folderNameToTypeMap.put(folder.getName(), folder.getType()); } assertEquals(FolderType.INBOX, folderNameToTypeMap.get("Inbox")); assertEquals(FolderType.REGULAR, folderNameToTypeMap.get("Drafts")); assertEquals(FolderType.REGULAR, folderNameToTypeMap.get("Folder2")); }