View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.rice.krad.labs.kitchensink;
17  
18  import org.junit.Test;
19  
20  /**
21   * Tests the Component section in Rice.
22   *
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public abstract class LabsValidCharsConstraintAft extends LabsKitchenSinkBase {
26  
27      /**
28       * /kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page4
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page4";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          navigateToKitchenSink("Validation - Regex");
40      }
41  
42      @Test
43      public void testValidCharsConstraintNav() throws Exception {
44          testValidCharsConstraintIT();
45          passed();
46      }
47  
48      @Test
49      public void testValidCharsConstraintBookmark() throws Exception {
50          testValidCharsConstraintIT();
51          passed();
52      }
53  
54      protected void testValidCharsConstraintIT() throws Exception {
55          assertFocusTypeBlurValidation("field50", new String[]{"12.333", "-123.33"}, new String[]{"123.33"});
56          assertFocusTypeBlurValidation("field51", new String[]{"A"}, new String[]{"-123.33"});
57  
58          // TODO continue to convert to assertFocusTypeBlurValidation
59          assertFocusTypeBlurValidation("field77", new String[]{"1.1"},new String[]{"12"});
60          assertFocusTypeBlurValidation("field52", new String[]{"5551112222"},new String[]{"555-111-1111"});
61          assertFocusTypeBlurValidation("field53", new String[]{"1ClassName.java"},new String[]{"ClassName.java"});
62          assertFocusTypeBlurValidation("field54", new String[]{"aaaaa"},new String[]{"aaaaa@kuali.org"});
63          assertFocusTypeBlurValidation("field84", new String[]{"aaaaa"},new String[]{"http://www.kuali.org"});
64          assertFocusTypeBlurValidation("field55", new String[]{"023512"},new String[]{"022812"});
65          assertFocusTypeBlurValidation("field75", new String[]{"02/35/12"},new String[]{"02/28/12"});
66          assertFocusTypeBlurValidation("field82", new String[]{"13:22"},new String[]{"02:33"});
67          assertFocusTypeBlurValidation("field83", new String[]{"25:22"},new String[]{"14:33"});
68          assertFocusTypeBlurValidation("field56", new String[]{"2020-06-02"},new String[]{"2020-06-02 03:30:30.22"});
69          assertFocusTypeBlurValidation("field57", new String[]{"0"},new String[]{"2020"});
70          assertFocusTypeBlurValidation("field58", new String[]{"13"},new String[]{"12"});
71          assertFocusTypeBlurValidation("field61", new String[]{"5555-444"},new String[]{"55555-4444"});
72          assertFocusTypeBlurValidation("field62", new String[]{"aa5bb6_a"},new String[]{"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"});
73          assertFocusTypeBlurValidation("field63", new String[]{"#fff555"},new String[]{"aa22 _/"});
74          assertFocusTypeBlurValidation("field64", new String[]{"AABB55"},new String[]{"ABCDEFGHIJKLMNOPQRSTUVWXY,Z abcdefghijklmnopqrstuvwxy,z"});
75          assertFocusTypeBlurValidation("field76", new String[]{"AA~BB%"},new String[]{"abcABC %$#@&<>\\{}[]*-+!=.()/\"\"',:;?"});
76          assertFocusTypeBlurValidation("field65", new String[]{"sdfs$#$# dsffs"},new String[]{"sdfs$#$#sffs"});
77          assertFocusTypeBlurValidation("field66", new String[]{"abcABCD"},new String[]{"ABCabc"});
78          assertFocusTypeBlurValidation("field67", new String[]{"(111)B-(222)A"},new String[]{"(12345)-(67890)"});
79          assertFocusTypeBlurValidation("field68", new String[]{"A.66"},new String[]{"a.4"});
80      }
81  }