01: package org.columba.mail.parser;
02:
03: import java.util.List;
04: import java.util.Vector;
05:
06: import junit.framework.TestCase;
07:
08: public class NormalizeRecipientListParserTest extends TestCase {
09:
10: /*
11: * test with null list
12: */
13: public void testNormalizeRCPTVectorNull() {
14:
15: try {
16: new NormalizeRecipientListParser()
17: .normalizeRCPTVector(null);
18: fail();
19: } catch (IllegalArgumentException e) {
20: }
21: }
22:
23: /*
24: * test with empty list
25: */
26: public void testNormalizeRCPTVectorEmptyList() {
27:
28: List<String> list = new Vector<String>();
29:
30: List<String> result = new NormalizeRecipientListParser()
31: .normalizeRCPTVector(list);
32: assertEquals(0, result.size());
33: }
34:
35: /*
36: * Test with all kinds of input data
37: */
38: public void testNormalizeRCPTVector() {
39:
40: List<String> list = new Vector<String>();
41: list.add("Firstname Lastname <mail@mail.org>");
42: list.add("<mail@mail.org>");
43: list.add("mail@mail.org");
44: list.add("\"Lastname, Firstname\" <mail@mail.org>");
45:
46: List<String> result = new NormalizeRecipientListParser()
47: .normalizeRCPTVector(list);
48: assertEquals(result.get(0), "<mail@mail.org>");
49: assertEquals(result.get(1), "<mail@mail.org>");
50: assertEquals(result.get(2), "<mail@mail.org>");
51: assertEquals(result.get(3), "<mail@mail.org>");
52: }
53:
54: }
|