01: // The contents of this file are subject to the Mozilla Public License Version
02: // 1.1
03: //(the "License"); you may not use this file except in compliance with the
04: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
05: //
06: //Software distributed under the License is distributed on an "AS IS" basis,
07: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
08: //for the specific language governing rights and
09: //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: * Testcases for generation of To: headerfield
26: *
27: * @author fdietz
28: */
29: public class ToTest extends TestCase {
30: /**
31: * Check if Reply-To: headerfield is used as default
32: *
33: */
34: public void testReplyTo() {
35: String s = "donald@mail.com";
36: Header header = new Header();
37: header.set("Reply-To", s);
38: header.set("From", "donald.duck@mail.com");
39:
40: String result = MessageBuilderHelper.createTo(header);
41:
42: assertEquals(s, result);
43: }
44:
45: /**
46: * Check if method is falling back to From: headerfield, if Reply-To:
47: * headerfield is not available
48: *
49: */
50: public void testReplyTo2() {
51: String s = "donald.duck@mail.com";
52: Header header = new Header();
53: header.set("From", "donald.duck@mail.com");
54:
55: String result = MessageBuilderHelper.createTo(header);
56:
57: assertEquals(s, result);
58: }
59:
60: /**
61: * Test it Reply-To: or From: headerfield and
62: * all To: and Cc: headerfields are concatenated correctly
63: *
64: */
65: public void testReplyToAll() {
66: String s = "donald@mail.com";
67: Header header = new Header();
68: header.set("Reply-To", s);
69: header.set("From", "donald.duck@mail.com");
70: header.set("To", "dagobert.duck@mail.com");
71: header.set("Cc",
72: "tick@mail.com, trick@mail.com, daisy@mail.com");
73:
74: String result = MessageBuilderHelper.createToAll(header);
75:
76: String 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: }
|