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.fieldlevel;
17:
18: import org.junit.Test;
19: import org.kuali.test.KNSTestBase;
20: import org.kuali.test.KNSWithTestSpringContext;
21:
22: @KNSWithTestSpringContext
23: public class MonthValidationPatternTest extends KNSTestBase {
24: MonthValidationPattern pattern;
25:
26: @Override
27: public void setUp() throws Exception {
28: super .setUp();
29:
30: pattern = new MonthValidationPattern();
31: }
32:
33: @Test
34: public final void testMatches_valid1() {
35: assertTrue(pattern.matches("1"));
36: }
37:
38: @Test
39: public final void testMatches_valid2() {
40: assertTrue(pattern.matches("01"));
41: }
42:
43: @Test
44: public final void testMatches_valid3() {
45: assertTrue(pattern.matches("11"));
46: }
47:
48: @Test
49: public final void testMatches_invalid1() {
50: assertFalse(pattern.matches("00"));
51: }
52:
53: @Test
54: public final void testMatches_invalid2() {
55: assertFalse(pattern.matches("0"));
56: }
57:
58: @Test
59: public final void testMatches_invalid3() {
60: assertFalse(pattern.matches("13"));
61: }
62: }
|