1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.james.transport.matchers;
22
23 import java.io.UnsupportedEncodingException;
24 import java.util.Collection;
25
26 import javax.mail.MessagingException;
27
28 import org.apache.mailet.Matcher;
29
30 public class SubjectIsTest extends AbstractSubjectIsTest {
31
32 private final String SUBJECT_NAME = "testSubject";
33
34 public SubjectIsTest(String arg0) throws UnsupportedEncodingException {
35 super(arg0);
36 }
37
38
39 public void testHostIsMatchedAllRecipients() throws MessagingException {
40 setSubject(SUBJECT_NAME);
41
42 setupAll();
43
44 Collection matchedRecipients = matcher.match(mockedMail);
45
46 assertNotNull(matchedRecipients);
47 assertEquals(matchedRecipients.size(), mockedMail.getRecipients()
48 .size());
49 }
50
51
52 public void testHostIsNotMatch() throws MessagingException {
53 setSubject("test");
54
55 setupAll();
56
57 Collection matchedRecipients = matcher.match(mockedMail);
58
59 assertNull(matchedRecipients);
60 }
61
62 protected Matcher createMatcher() {
63 return new SubjectIs();
64 }
65
66 protected String getConfigOption() {
67 return "SubjectIs=";
68 }
69
70 protected String getSubjectName() {
71 return SUBJECT_NAME;
72 }
73 }