1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.jsieve;
21
22 import junit.framework.TestCase;
23
24 import org.apache.jsieve.parser.generated.ParseException;
25 import org.apache.jsieve.utils.JUnitUtils;
26
27
28
29
30 public class RequireMissingTest extends TestCase {
31
32
33
34
35 public void testUnsupportedRequireNoBrackets() throws Exception {
36 String script = "require \"whatever\"; if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; }";
37 try {
38 JUnitUtils.parse(script);
39 fail("Expect exception to be throw during parse since command is unsupported");
40 } catch (ParseException e) {
41
42 }
43 }
44
45
46
47
48 public void testUnsupportedRequireMultiple() throws Exception {
49 String script = "require [\"fileinto\",\"whatever\"]; if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; }";
50 try {
51 JUnitUtils.parse(script);
52 fail("Expect exception to be throw during parse since command is unsupported");
53 } catch (ParseException e) {
54
55 }
56 }
57
58
59
60
61 public void testUnsupportedRequire() throws Exception {
62 String script = "require [\"whatever\"]; if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; }";
63 try {
64 JUnitUtils.parse(script);
65 fail("Expect exception to be throw during parse since command is unsupported");
66 } catch (ParseException e) {
67
68 }
69 }
70
71
72
73
74
75
76 public void testMissingRequire() throws Exception {
77 String script = "if address :contains [\"To\", \"From\"] \"Fish!\"{ bogus \"aFolder\"; }";
78 try {
79 JUnitUtils.parse(script);
80 fail("Expect exception to be throw during parse since command is missing");
81 } catch (ParseException e) {
82
83 }
84 }
85
86
87
88
89
90 public void testRequireAfterOtherCommand() throws Exception {
91 String script = "if address :contains [\"To\", \"From\"] \"Fish!\"{ fileinto \"aFolder\"; } require [\"whatever\"]; ";
92 try {
93 JUnitUtils.parse(script);
94 fail("Expect exception to be throw during parse");
95 } catch (ParseException e) {
96
97 }
98 }
99 }