@Test public void getDisplayName_forInboxFolderAlternativeCase_returnsInbox() { when(mockAccount.getInboxFolderId()).thenReturn("FOLDERID"); String result = FolderInfoHolder.getDisplayName(context, mockAccount, "FolderID", "Folder"); assertEquals("Inbox", result); }
public static String getDisplayName(Context context, Account account, String id, String name) { final String displayName; if (id.equals(account.getSpamFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_spam_fmt), name); } else if (id.equals(account.getArchiveFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_archive_fmt), name); } else if (id.equals(account.getSentFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_sent_fmt), name); } else if (id.equals(account.getTrashFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_trash_fmt), name); } else if (id.equals(account.getDraftsFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_drafts_fmt), name); } else if (id.equals(account.getOutboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_outbox); } else if (id.equalsIgnoreCase(account.getInboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_inbox); } else if (name == null) { displayName = id; } else { displayName = name; } return displayName; }
FolderInfoHolder implements Comparable<FolderInfoHolder> { public static String getDisplayName(Context context, Account account, String id, String name) { final String displayName; if (id.equals(account.getSpamFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_spam_fmt), name); } else if (id.equals(account.getArchiveFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_archive_fmt), name); } else if (id.equals(account.getSentFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_sent_fmt), name); } else if (id.equals(account.getTrashFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_trash_fmt), name); } else if (id.equals(account.getDraftsFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_drafts_fmt), name); } else if (id.equals(account.getOutboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_outbox); } else if (id.equalsIgnoreCase(account.getInboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_inbox); } else if (name == null) { displayName = id; } else { displayName = name; } return displayName; } }
FolderInfoHolder implements Comparable<FolderInfoHolder> { public static String getDisplayName(Context context, Account account, String id, String name) { final String displayName; if (id.equals(account.getSpamFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_spam_fmt), name); } else if (id.equals(account.getArchiveFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_archive_fmt), name); } else if (id.equals(account.getSentFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_sent_fmt), name); } else if (id.equals(account.getTrashFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_trash_fmt), name); } else if (id.equals(account.getDraftsFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_drafts_fmt), name); } else if (id.equals(account.getOutboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_outbox); } else if (id.equalsIgnoreCase(account.getInboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_inbox); } else if (name == null) { displayName = id; } else { displayName = name; } return displayName; } FolderInfoHolder();  FolderInfoHolder(Context context, LocalFolder folder, Account account);  FolderInfoHolder(Context context, LocalFolder folder, Account account, int unreadCount); }
FolderInfoHolder implements Comparable<FolderInfoHolder> { public static String getDisplayName(Context context, Account account, String id, String name) { final String displayName; if (id.equals(account.getSpamFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_spam_fmt), name); } else if (id.equals(account.getArchiveFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_archive_fmt), name); } else if (id.equals(account.getSentFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_sent_fmt), name); } else if (id.equals(account.getTrashFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_trash_fmt), name); } else if (id.equals(account.getDraftsFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_drafts_fmt), name); } else if (id.equals(account.getOutboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_outbox); } else if (id.equalsIgnoreCase(account.getInboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_inbox); } else if (name == null) { displayName = id; } else { displayName = name; } return displayName; } FolderInfoHolder();  FolderInfoHolder(Context context, LocalFolder folder, Account account);  FolderInfoHolder(Context context, LocalFolder folder, Account account, int unreadCount); @Override boolean equals(Object o); @Override int hashCode(); int compareTo(FolderInfoHolder o); void populate(Context context, LocalFolder folder, Account account, int unreadCount); void populate(Context context, LocalFolder folder, Account account); static String getDisplayName(Context context, Account account, String id, String name); void setMoreMessagesFromFolder(LocalFolder folder); }
FolderInfoHolder implements Comparable<FolderInfoHolder> { public static String getDisplayName(Context context, Account account, String id, String name) { final String displayName; if (id.equals(account.getSpamFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_spam_fmt), name); } else if (id.equals(account.getArchiveFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_archive_fmt), name); } else if (id.equals(account.getSentFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_sent_fmt), name); } else if (id.equals(account.getTrashFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_trash_fmt), name); } else if (id.equals(account.getDraftsFolderId())) { displayName = String.format( context.getString(R.string.special_mailbox_name_drafts_fmt), name); } else if (id.equals(account.getOutboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_outbox); } else if (id.equalsIgnoreCase(account.getInboxFolderId())) { displayName = context.getString(R.string.special_mailbox_name_inbox); } else if (name == null) { displayName = id; } else { displayName = name; } return displayName; } FolderInfoHolder();  FolderInfoHolder(Context context, LocalFolder folder, Account account);  FolderInfoHolder(Context context, LocalFolder folder, Account account, int unreadCount); @Override boolean equals(Object o); @Override int hashCode(); int compareTo(FolderInfoHolder o); void populate(Context context, LocalFolder folder, Account account, int unreadCount); void populate(Context context, LocalFolder folder, Account account); static String getDisplayName(Context context, Account account, String id, String name); void setMoreMessagesFromFolder(LocalFolder folder); public String id; public String name; public String displayName; public long lastChecked; public int unreadMessageCount; public int flaggedMessageCount; public boolean loading; public String status; public boolean lastCheckFailed; public Folder folder; public boolean pushActive; public boolean moreMessages; }