1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.validation.fieldlevel;
17
18 import org.junit.Test;
19 import org.kuali.rice.kns.datadictionary.validation.fieldlevel.MonthValidationPattern;
20 import org.kuali.test.KRADTestCase;
21
22 import static org.junit.Assert.assertFalse;
23 import static org.junit.Assert.assertTrue;
24
25 public class MonthValidationPatternTest extends KRADTestCase {
26 MonthValidationPattern pattern;
27
28 @Override
29 public void setUp() throws Exception {
30 super.setUp();
31
32 pattern = new MonthValidationPattern();
33 }
34
35 @Test public final void testMatches_valid1() {
36 assertTrue(pattern.matches("1"));
37 }
38
39 @Test public final void testMatches_valid2() {
40 assertTrue(pattern.matches("01"));
41 }
42
43 @Test public final void testMatches_valid3() {
44 assertTrue(pattern.matches("11"));
45 }
46
47
48 @Test public final void testMatches_invalid1() {
49 assertFalse(pattern.matches("00"));
50 }
51
52 @Test public final void testMatches_invalid2() {
53 assertFalse(pattern.matches("0"));
54 }
55
56 @Test public final void testMatches_invalid3() {
57 assertFalse(pattern.matches("13"));
58 }
59 }