### Question:
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETED), true); } else { ImapFolder remoteTrashFolder = getStore().getFolder(trashFolderName); String encodedTrashFolderName = folderNameCodec.encode(remoteTrashFolder.getPrefixedId()); String escapedTrashFolderName = ImapUtility.encodeString(encodedTrashFolderName); if (!exists(escapedTrashFolderName)) { if (K9MailLib.isDebug()) { Timber.i("IMAPMessage.delete: attempting to create remote '%s' folder for %s", trashFolderName, getLogId()); } remoteTrashFolder.create(FolderType.HOLDS_MESSAGES); } if (exists(escapedTrashFolderName)) { if (K9MailLib.isDebug()) { Timber.d("IMAPMessage.delete: copying remote %d messages to '%s' for %s", messages.size(), trashFolderName, getLogId()); } moveMessages(messages, remoteTrashFolder); } else { throw new MessagingException("IMAPMessage.delete: remote Trash folder " + trashFolderName + " does not exist and could not be created for " + getLogId(), true); } } } ImapFolder(ImapStore store, String id);   ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Override boolean isOpen(); @Override int getMode(); @Override void close(); @Override String getId(); @Override String getParentId(); @Override String getName(); @Override boolean exists(); @Override boolean canHaveSubFolders(); @Override boolean create(FolderType type); @Override Map<String, String> copyMessages(List<? extends Message> messages, Folder folder); @Override Map<String, String> moveMessages(List<? extends Message> messages, Folder folder); @Override void delete(List<? extends Message> messages, String trashFolderName); @Override int getMessageCount(); @Override int getUnreadMessageCount(); @Override int getFlaggedMessageCount(); @Override void delete(boolean recurse); @Override ImapMessage getMessage(String uid); @Override List<ImapMessage> getMessages(int start, int end, Date earliestDate,
            MessageRetrievalListener<ImapMessage> listener); @Override boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate); @Override void fetch(List<ImapMessage> messages, FetchProfile fetchProfile,
            MessageRetrievalListener<ImapMessage> listener); @Override void fetchPart(Message message, Part part, MessageRetrievalListener<Message> listener,
            BodyFactory bodyFactory); @Override Map<String, String> appendMessages(List<? extends Message> messages); @Override String getUidFromMessageId(Message message); @Override void expunge(); @Override void setFlags(Set<Flag> flags, boolean value); @Override String getNewPushState(String oldSerializedPushState, Message message); @Override void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value); @Override boolean equals(Object other); @Override int hashCode(); @Override List<ImapMessage> search(final String queryString, final Set<Flag> requiredFlags,
            final Set<Flag> forbiddenFlags);  }### Answer:
@Test public void delete_withEmptyMessageList_shouldNotInteractWithImapConnection() throws Exception { ImapFolder folder = createFolder("Source"); List<ImapMessage> messages = Collections.emptyList(); folder.delete(messages, "Trash"); verifyNoMoreInteractions(imapConnection); }
@Test(expected = Error.class) public void delete_notImplemented() throws Exception { ImapFolder folder = createFolder("Folder"); folder.delete(false); }