1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.validation.charlevel;
17
18 import org.junit.Test;
19 import org.kuali.rice.kns.datadictionary.validation.charlevel.AlphaValidationPattern;
20 import org.kuali.rice.krad.datadictionary.validation.ValidationTestUtils;
21 import org.kuali.rice.test.BaseRiceTestCase;
22
23 public class AlphaValidationPatternTest extends BaseRiceTestCase {
24 private AlphaValidationPattern pattern;
25
26 @Override
27 public void setUp() throws Exception {
28 super.setUp();
29 pattern = new AlphaValidationPattern();
30 }
31
32
33 @Test public final void testMatch_allowDefault() {
34 boolean[] expected = { true,
35 false,
36 false,
37 false,
38 true,
39 false,
40 false,
41 false,
42 false,
43 false,
44 false,
45 false,
46 false,
47 false,
48 false,
49 false,
50 false,
51 };
52
53 ValidationTestUtils.assertPatternMatches(pattern, expected);
54 }
55
56 @Test public final void testMatch_allowWhitespace() {
57 boolean[] expected = { true,
58 false,
59 false,
60 false,
61 true,
62 true,
63 false,
64 false,
65 false,
66 false,
67 false,
68 false,
69 false,
70 false,
71 false,
72 false,
73 false,
74 };
75
76 pattern.setAllowWhitespace(true);
77 ValidationTestUtils.assertPatternMatches(pattern, expected);
78 }
79
80 }