KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > composer > ToTest


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.composer;
19
20 import junit.framework.TestCase;
21
22 import org.columba.ristretto.message.Header;
23
24
25 /**
26  * Testcases for generation of To: headerfield
27  *
28  * @author fdietz
29  */

30 public class ToTest extends TestCase {
31     /**
32  * Check if Reply-To: headerfield is used as default
33  *
34  */

35     public void testReplyTo() {
36         String JavaDoc s = "donald@mail.com";
37         Header header = new Header();
38         header.set("Reply-To", s);
39         header.set("From", "donald.duck@mail.com");
40
41         String JavaDoc result = MessageBuilderHelper.createTo(header);
42
43         assertEquals(s, result);
44     }
45
46     /**
47  * Check if method is falling back to From: headerfield, if Reply-To:
48  * headerfield is not available
49  *
50  */

51     public void testReplyTo2() {
52         String JavaDoc s = "donald.duck@mail.com";
53         Header header = new Header();
54         header.set("From", "donald.duck@mail.com");
55
56         String JavaDoc result = MessageBuilderHelper.createTo(header);
57
58         assertEquals(s, result);
59     }
60
61     /**
62  * Test it Reply-To: or From: headerfield and
63  * all To: and Cc: headerfields are concatenated correctly
64  *
65  */

66     public void testReplyToAll() {
67         String JavaDoc s = "donald@mail.com";
68         Header header = new Header();
69         header.set("Reply-To", s);
70         header.set("From", "donald.duck@mail.com");
71         header.set("To", "dagobert.duck@mail.com");
72         header.set("Cc", "tick@mail.com, trick@mail.com, daisy@mail.com");
73
74         String JavaDoc result = MessageBuilderHelper.createToAll(header);
75
76         String JavaDoc shouldbe = "donald@mail.com, dagobert.duck@mail.com, tick@mail.com, trick@mail.com, daisy@mail.com";
77
78         assertEquals(shouldbe, result);
79     }
80
81     /**
82  *
83  * Check if method is falling back to X-BeenThere:, to Reply-To or From: headerfield,
84  * if not available
85  *
86  */

87     public void testReplyToMailinglist() {
88         // TODO (@author fdietz):: implement test
89
}
90 }
91
Popular Tags