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.AnyCharacterValidationPattern;
20 import org.kuali.rice.krad.datadictionary.validation.ValidationTestUtils;
21 import org.kuali.rice.test.BaseRiceTestCase;
22
23
24
25
26
27
28 public class AnyCharacterValidationPatternTest extends BaseRiceTestCase {
29 private AnyCharacterValidationPattern pattern;
30
31 @Override
32 public void setUp() throws Exception {
33 super.setUp();
34
35 pattern = new AnyCharacterValidationPattern();
36 }
37
38
39
40
41 @Test public final void testMatch_allowDefault() {
42 boolean[] expected = { true,
43 true,
44 true,
45 true,
46 true,
47 false,
48 true,
49 true,
50 false,
51 true,
52 true,
53 true,
54 false,
55 false,
56 true,
57 true,
58 false,
59 };
60
61 ValidationTestUtils.assertPatternMatches(pattern, expected);
62 }
63
64
65
66
67 @Test public final void testMatch_allowWhitespace() {
68 boolean[] expected = { true,
69 true,
70 true,
71 true,
72 true,
73 true,
74 true,
75 true,
76 true,
77 true,
78 true,
79 true,
80 true,
81 true,
82 true,
83 true,
84 true,
85 };
86
87 pattern.setAllowWhitespace(true);
88 ValidationTestUtils.assertPatternMatches(pattern, expected);
89 }
90 }