1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.wallace.javamail;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import javax.mail.Flags;
25 import javax.mail.Folder;
26 import javax.mail.Message;
27 import javax.mail.MessagingException;
28 import javax.mail.Store;
29
30 /***
31 *
32 *
33 * @author rnewson
34 */
35 public class MockFolder extends Folder {
36
37 private Map<String, Folder> folders = new HashMap<String, Folder>();
38
39 private boolean exists = false;
40
41 private boolean isOpen = false;
42
43 public MockFolder(final Store newStore) {
44 super(newStore);
45 }
46
47 public String getName() {
48 return null;
49 }
50
51 public String getFullName() {
52 return null;
53 }
54
55 public Folder getParent() throws MessagingException {
56 return null;
57 }
58
59 public void setExists(final boolean newExists) {
60 exists = newExists;
61 }
62
63 public boolean exists() {
64 return exists;
65 }
66
67 /***
68 *
69 */
70
71 public Folder[] list(String pattern) throws MessagingException {
72 return null;
73 }
74
75 /***
76 *
77 */
78
79 public char getSeparator() throws MessagingException {
80 return 0;
81 }
82
83 /***
84 *
85 */
86
87 public int getType() throws MessagingException {
88 return 0;
89 }
90
91 /***
92 *
93 */
94
95 public boolean create(int type) throws MessagingException {
96 return false;
97 }
98
99 /***
100 *
101 */
102
103 public boolean hasNewMessages() throws MessagingException {
104 return false;
105 }
106
107 public void setFolder(final String name, final Folder folder) {
108 folders.put(name, folder);
109 }
110
111 public Folder getFolder(String name) throws MessagingException {
112 return folders.get(name);
113 }
114
115 /***
116 *
117 */
118
119 public boolean delete(boolean recurse) throws MessagingException {
120 return false;
121 }
122
123 /***
124 *
125 */
126
127 public boolean renameTo(Folder folder) throws MessagingException {
128 return false;
129 }
130
131 /***
132 *
133 */
134
135 public void open(int newMode) throws MessagingException {
136 isOpen = true;
137 }
138
139 public void close(boolean expunge) throws MessagingException {
140 isOpen = false;
141 }
142
143 /***
144 *
145 */
146
147 public boolean isOpen() {
148 return isOpen;
149 }
150
151 /***
152 *
153 */
154
155 public Flags getPermanentFlags() {
156 return null;
157 }
158
159 /***
160 *
161 */
162
163 public int getMessageCount() throws MessagingException {
164 return 0;
165 }
166
167 /***
168 *
169 */
170
171 public Message getMessage(int msgnum) throws MessagingException {
172 return null;
173 }
174
175 /***
176 *
177 */
178
179 public void appendMessages(Message[] msgs) throws MessagingException {
180 }
181
182 /***
183 *
184 */
185
186 public Message[] expunge() throws MessagingException {
187 return null;
188 }
189
190 }