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