01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.core.datadictionary.validation.charlevel;
17:
18: import org.junit.Test;
19: import org.kuali.core.datadictionary.validation.ValidationTestUtils;
20: import org.kuali.test.KNSTestBase;
21:
22: public class NumericValidationPatternTest extends KNSTestBase {
23: private NumericValidationPattern pattern;
24:
25: @Override
26: public void setUp() throws Exception {
27: super .setUp();
28:
29: pattern = new NumericValidationPattern();
30: }
31:
32: @Test
33: public final void testMatch_allowDefault() {
34: boolean[] expected = { true, // ""
35: false, // "!!!"
36: false, // "[a-9]"
37: false, // "^A-Z"
38: false, // "abc"
39: false, // "a bc"
40: false, // "a_bc"
41: true, // "123"
42: false, // "12 3"
43: false, // "12_3"
44: false, // "a1b2c3"
45: false, // "a1b2_c3"
46: false, // "a 1b2c3"
47: false, // "a 1b2_c3"
48: };
49:
50: ValidationTestUtils.assertPatternMatches(pattern, expected);
51: }
52: }
|