Source Code Cross Referenced for CharsetValidationPatternTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » datadictionary » validation » charlevel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.core.datadictionary.validation.charlevel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2006 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.core.datadictionary.validation.charlevel;
017:
018:        import org.junit.Test;
019:        import org.kuali.test.KNSTestBase;
020:
021:        public class CharsetValidationPatternTest extends KNSTestBase {
022:            private CharsetValidationPattern charsetPattern;
023:
024:            @Override
025:            public void setUp() throws Exception {
026:                super .setUp();
027:
028:                charsetPattern = new CharsetValidationPattern();
029:            }
030:
031:            @Test
032:            public final void testSetBoth_AB() {
033:                boolean failedAsExpected = false;
034:
035:                try {
036:                    charsetPattern.setMaxLength(5);
037:                    charsetPattern.setExactLength(5);
038:                } catch (IllegalStateException e) {
039:                    failedAsExpected = true;
040:                }
041:
042:                assertTrue(failedAsExpected);
043:            }
044:
045:            @Test
046:            public final void testSetBoth_BA() {
047:                boolean failedAsExpected = false;
048:
049:                try {
050:                    charsetPattern.setExactLength(5);
051:                    charsetPattern.setMaxLength(5);
052:                } catch (IllegalStateException e) {
053:                    failedAsExpected = true;
054:                }
055:
056:                assertTrue(failedAsExpected);
057:            }
058:
059:            @Test
060:            public final void testMatch_exactLength1() {
061:                charsetPattern.setExactLength(3);
062:                charsetPattern.setValidChars("abc");
063:
064:                assertFalse(charsetPattern.matches("aaaa"));
065:            }
066:
067:            @Test
068:            public final void testMatch_exactLength2() {
069:                charsetPattern.setExactLength(3);
070:                charsetPattern.setValidChars("abc");
071:
072:                assertFalse(charsetPattern.matches("aa"));
073:            }
074:
075:            @Test
076:            public final void testMatch_exactLength3() {
077:                charsetPattern.setExactLength(3);
078:                charsetPattern.setValidChars("abc");
079:
080:                assertTrue(charsetPattern.matches("aaa"));
081:            }
082:
083:            @Test
084:            public final void testMatch_maxLength1() {
085:                charsetPattern.setMaxLength(3);
086:                charsetPattern.setValidChars("abc");
087:
088:                assertFalse(charsetPattern.matches("aaaa"));
089:            }
090:
091:            @Test
092:            public final void testMatch_maxLength2() {
093:                charsetPattern.setMaxLength(3);
094:                charsetPattern.setValidChars("abc");
095:
096:                assertTrue(charsetPattern.matches("aa"));
097:            }
098:
099:            @Test
100:            public final void testMatch_maxLength3() {
101:                charsetPattern.setMaxLength(3);
102:                charsetPattern.setValidChars("abc");
103:
104:                assertTrue(charsetPattern.matches("aaa"));
105:            }
106:
107:            @Test
108:            public final void testSetValidChars_emptyString() {
109:                boolean failedAsExpected = false;
110:
111:                try {
112:                    charsetPattern.setValidChars("");
113:                } catch (IllegalArgumentException e) {
114:                    failedAsExpected = true;
115:                }
116:
117:                assertTrue(failedAsExpected);
118:            }
119:
120:            @Test
121:            public final void testMatch_trailingSlash1() {
122:                charsetPattern.setValidChars("abcd\\");
123:
124:                assertTrue(charsetPattern.matches("a"));
125:            }
126:
127:            @Test
128:            public final void testMatch_trailingSlash2() {
129:                charsetPattern.setValidChars("abcd\\");
130:
131:                assertTrue(charsetPattern.matches("c"));
132:            }
133:
134:            @Test
135:            public final void testMatch_trailingSlash3() {
136:                charsetPattern.setValidChars("abcd\\");
137:
138:                assertTrue(charsetPattern.matches("\\"));
139:            }
140:
141:            @Test
142:            public final void testMatch_pseudoSet1() {
143:                charsetPattern.setValidChars("[A-Z]");
144:
145:                assertTrue(charsetPattern.matches("A"));
146:            }
147:
148:            @Test
149:            public final void testMatch_pseudoSet2() {
150:                charsetPattern.setValidChars("[A-Z]");
151:
152:                assertTrue(charsetPattern.matches("Z"));
153:            }
154:
155:            @Test
156:            public final void testMatch_pseudoSet3() {
157:                charsetPattern.setValidChars("[A-Z]");
158:
159:                assertTrue(charsetPattern.matches("-"));
160:            }
161:
162:            @Test
163:            public final void testMatch_pseudoSet4() {
164:                charsetPattern.setValidChars("[A-Z]");
165:
166:                assertTrue(charsetPattern.matches("["));
167:            }
168:
169:            @Test
170:            public final void testMatch_pseudoSet5() {
171:                charsetPattern.setValidChars("[A-Z]");
172:
173:                assertFalse(charsetPattern.matches("C"));
174:            }
175:
176:            @Test
177:            public final void testMatch_partialPseudoSet1() {
178:                charsetPattern.setValidChars("[ABC");
179:
180:                assertTrue(charsetPattern.matches("A"));
181:            }
182:
183:            @Test
184:            public final void testMatch_partialPseudoSet2() {
185:                charsetPattern.setValidChars("[ABC");
186:
187:                assertFalse(charsetPattern.matches("Z"));
188:            }
189:
190:            @Test
191:            public final void testMatch_pseudoSetTrailingSlash1() {
192:                charsetPattern.setValidChars("[A-Z]\\");
193:
194:                assertTrue(charsetPattern.matches("A"));
195:            }
196:
197:            @Test
198:            public final void testMatch_pseudoSetTrailingSlash2() {
199:                charsetPattern.setValidChars("[A-Z]\\");
200:
201:                assertTrue(charsetPattern.matches("Z"));
202:            }
203:
204:            @Test
205:            public final void testMatch_pseudoSetTrailingSlash3() {
206:                charsetPattern.setValidChars("[A-Z]\\");
207:
208:                assertTrue(charsetPattern.matches("-"));
209:            }
210:
211:            @Test
212:            public final void testMatch_pseudoSetTrailingSlash4() {
213:                charsetPattern.setValidChars("[A-Z]\\");
214:
215:                assertTrue(charsetPattern.matches("["));
216:            }
217:
218:            @Test
219:            public final void testMatch_pseudoSetTrailingSlash5() {
220:                charsetPattern.setValidChars("[A-Z]\\");
221:
222:                assertFalse(charsetPattern.matches("C"));
223:            }
224:
225:            @Test
226:            public final void testMatch_pseudoCapture1() {
227:                charsetPattern.setValidChars("(ABC)");
228:
229:                assertTrue(charsetPattern.matches("("));
230:            }
231:
232:            @Test
233:            public final void testMatch_pseudoCapture2() {
234:                charsetPattern.setValidChars("(ABC)");
235:
236:                assertTrue(charsetPattern.matches(")"));
237:            }
238:
239:            @Test
240:            public final void testMatch_pseudoCapture3() {
241:                charsetPattern.setValidChars("(ABC)");
242:
243:                assertTrue(charsetPattern.matches("B"));
244:            }
245:
246:            @Test
247:            public final void testMatch_pseudoRange1() {
248:                charsetPattern.setValidChars("A-Z");
249:
250:                assertTrue(charsetPattern.matches("A"));
251:            }
252:
253:            @Test
254:            public final void testMatch_pseudoRange2() {
255:                charsetPattern.setValidChars("A-Z");
256:
257:                assertTrue(charsetPattern.matches("-"));
258:            }
259:
260:            @Test
261:            public final void testMatch_pseudoRange3() {
262:                charsetPattern.setValidChars("A-Z");
263:
264:                assertFalse(charsetPattern.matches("B"));
265:            }
266:
267:            @Test
268:            public final void testMatch_pseudoIntersection1() {
269:                charsetPattern.setValidChars("A&&Z");
270:
271:                assertTrue(charsetPattern.matches("A"));
272:            }
273:
274:            @Test
275:            public final void testMatch_pseudoIntersection2() {
276:                charsetPattern.setValidChars("A&&Z");
277:
278:                assertTrue(charsetPattern.matches("&"));
279:            }
280:
281:            @Test
282:            public final void testMatch_pseudoIntersection3() {
283:                charsetPattern.setValidChars("A&&Z");
284:
285:                assertTrue(charsetPattern.matches("Z"));
286:            }
287:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.