KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > filter > plugins > AccountFilterTest


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.mail.filter.plugins;
19
20 import org.columba.mail.filter.MailFilterCriteria;
21 import org.columba.mail.filter.MailFilterFactory;
22 import org.columba.mail.folder.MailboxTstFactory;
23
24 /**
25  * @author fdietz
26  *
27  */

28 public class AccountFilterTest extends AbstractFilterTst {
29
30     /**
31      * @param arg0
32      */

33     public AccountFilterTest(String JavaDoc arg0) {
34         super(arg0);
35
36     }
37
38     /**
39      * @param arg0
40      */

41     public AccountFilterTest(MailboxTstFactory factory, String JavaDoc arg0) {
42         super(factory, arg0);
43
44     }
45
46     public void testAccountWithUid0() throws Exception JavaDoc {
47         // add message to folder
48
Object JavaDoc uid = addMessage();
49
50         getSourceFolder().setAttribute(uid, "columba.accountuid",
51                 new Integer JavaDoc(0));
52
53         // create filter configuration
54
MailFilterCriteria criteria = MailFilterFactory.createAccountIs(0);
55
56         // create filter
57
AccountFilter filter = new AccountFilter();
58
59         // init configuration
60
filter.setUp(criteria);
61
62         // execute filter
63
boolean result = filter.process(getSourceFolder(), uid);
64         assertEquals("filter result", true, result);
65     }
66
67     public void testAccountWithUid1() throws Exception JavaDoc {
68         // add message to folder
69
Object JavaDoc uid = addMessage();
70
71         getSourceFolder().setAttribute(uid, "columba.accountuid",
72                 new Integer JavaDoc(1));
73
74         // create filter configuration
75
MailFilterCriteria criteria = MailFilterFactory.createAccountIs(1);
76
77         // create filter
78
AccountFilter filter = new AccountFilter();
79
80         // init configuration
81
filter.setUp(criteria);
82
83         // execute filter
84
boolean result = filter.process(getSourceFolder(), uid);
85         assertEquals("filter result", true, result);
86     }
87 }
Popular Tags