com.emarsys.ecommon.mail.mock
Class MockFolder

java.lang.Object
  extended by javax.mail.Folder
      extended by com.emarsys.ecommon.mail.mock.MockFolder
Direct Known Subclasses:
PopMockFolder

public class MockFolder
extends javax.mail.Folder

A Folder backed by a MockMailbox.

Author:
Michael "kULO" Kulovits

Field Summary
protected  MockMailbox mailbox
           
protected  java.lang.String name
           
protected  boolean open
           
 
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
Constructor Summary
MockFolder(MockStore store, MockMailbox mailbox, java.lang.String name)
           
 
Method Summary
 void appendMessages(javax.mail.Message[] msgs)
           
 void close(boolean expunge)
           
 boolean create(int type)
           
 boolean delete(boolean recurse)
           
protected  javax.mail.Message[] doExpunge()
           
 boolean exists()
           
 javax.mail.Message[] expunge()
           
 javax.mail.Folder getFolder(java.lang.String name)
           
 java.lang.String getFullName()
           
static MockFolder getInstance(MockStore store, MockMailbox mailbox, java.lang.String name)
           
protected  java.util.List<javax.mail.Message> getMailboxFolder()
           
 javax.mail.Message getMessage(int index)
           
 int getMessageCount()
           
 java.lang.String getName()
           
 javax.mail.Folder getParent()
           
 javax.mail.Flags getPermanentFlags()
           
 char getSeparator()
           
 int getType()
           
 boolean hasNewMessages()
           
 boolean isOpen()
           
 javax.mail.Folder[] list(java.lang.String pattern)
           
 void open(int mode)
           
 boolean renameTo(javax.mail.Folder f)
           
 
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, fetch, finalize, getDeletedMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, getURLName, isSubscribed, list, listSubscribed, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, setSubscribed, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

mailbox

protected final MockMailbox mailbox

open

protected boolean open
Constructor Detail

MockFolder

public MockFolder(MockStore store,
                  MockMailbox mailbox,
                  java.lang.String name)
Parameters:
store -
mailbox -
Method Detail

getInstance

public static MockFolder getInstance(MockStore store,
                                     MockMailbox mailbox,
                                     java.lang.String name)

getMailboxFolder

protected java.util.List<javax.mail.Message> getMailboxFolder()
Returns:

getName

public java.lang.String getName()
Specified by:
getName in class javax.mail.Folder
See Also:
Folder.getName()

getFullName

public java.lang.String getFullName()
Specified by:
getFullName in class javax.mail.Folder
See Also:
Folder.getFullName()

getParent

public javax.mail.Folder getParent()
                            throws javax.mail.MessagingException
Specified by:
getParent in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.getParent()

exists

public boolean exists()
               throws javax.mail.MessagingException
Specified by:
exists in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.exists()

list

public javax.mail.Folder[] list(java.lang.String pattern)
                         throws javax.mail.MessagingException
Specified by:
list in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.list(java.lang.String)

getSeparator

public char getSeparator()
                  throws javax.mail.MessagingException
Specified by:
getSeparator in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.getSeparator()

getType

public int getType()
            throws javax.mail.MessagingException
Specified by:
getType in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.getType()

create

public boolean create(int type)
               throws javax.mail.MessagingException
Specified by:
create in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.create(int)

hasNewMessages

public boolean hasNewMessages()
                       throws javax.mail.MessagingException
Specified by:
hasNewMessages in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.hasNewMessages()

getFolder

public javax.mail.Folder getFolder(java.lang.String name)
                            throws javax.mail.MessagingException
Specified by:
getFolder in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.getFolder(java.lang.String)

delete

public boolean delete(boolean recurse)
               throws javax.mail.MessagingException
Specified by:
delete in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.delete(boolean)

renameTo

public boolean renameTo(javax.mail.Folder f)
                 throws javax.mail.MessagingException
Specified by:
renameTo in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.renameTo(javax.mail.Folder)

open

public void open(int mode)
          throws javax.mail.MessagingException
Specified by:
open in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.open(int)

close

public void close(boolean expunge)
           throws javax.mail.MessagingException
Specified by:
close in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.close(boolean)

isOpen

public boolean isOpen()
Specified by:
isOpen in class javax.mail.Folder
See Also:
Folder.isOpen()

getPermanentFlags

public javax.mail.Flags getPermanentFlags()
Specified by:
getPermanentFlags in class javax.mail.Folder
See Also:
Folder.getPermanentFlags()

getMessageCount

public int getMessageCount()
                    throws javax.mail.MessagingException
Specified by:
getMessageCount in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.getMessageCount()

getMessage

public javax.mail.Message getMessage(int index)
                              throws javax.mail.MessagingException
Specified by:
getMessage in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.getMessage(int)

appendMessages

public void appendMessages(javax.mail.Message[] msgs)
                    throws javax.mail.MessagingException
Specified by:
appendMessages in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.appendMessages(javax.mail.Message[])

expunge

public javax.mail.Message[] expunge()
                             throws javax.mail.MessagingException
Specified by:
expunge in class javax.mail.Folder
Throws:
javax.mail.MessagingException
See Also:
Folder.expunge()

doExpunge

protected javax.mail.Message[] doExpunge()
                                  throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException


Copyright © 2010 emarsys AG. All Rights Reserved.