1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.jsieve.comparators;
20
21 import junit.framework.TestCase;
22
23 import org.apache.jsieve.parser.generated.ParseException;
24 import org.apache.jsieve.utils.JUnitUtils;
25
26 public class RequireComparatorTest extends TestCase {
27
28 protected void setUp() throws Exception {
29 super.setUp();
30 }
31
32 protected void tearDown() throws Exception {
33 super.tearDown();
34 }
35
36 public void testAsciiCasemapShouldBeImplicitlyDeclared() throws Exception {
37 String script = "if header :contains :comparator \"i;ascii-casemap\" \"Subject\" \"69\" {stop;}";
38 JUnitUtils.interpret(JUnitUtils.createMail(), script);
39 }
40
41 public void testOctetShouldBeImplicitlyDeclared() throws Exception {
42 String script = "if header :contains :comparator \"i;octet\" \"Subject\" \"69\" {stop;}";
43 JUnitUtils.interpret(JUnitUtils.createMail(), script);
44 }
45
46 public void testBogusComparatorShouldFailAtParseTime() throws Exception {
47 String script = "if header :contains :comparator \"i;bogus\" \"Subject\" \"69\" {stop;}";
48 try {
49 JUnitUtils.interpret(JUnitUtils.createMail(), script);
50 fail("Bogus comparator should fail");
51 } catch (ParseException e) {
52
53
54 }
55 }
56 }