Source Code Cross Referenced for PhoneNumberServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » vendor » service » 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.module.vendor.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 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.module.vendor.service;
017:
018:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
019:
020:        import org.kuali.core.web.format.FormatException;
021:        import org.kuali.kfs.context.KualiTestBase;
022:        import org.kuali.kfs.context.SpringContext;
023:        import org.kuali.test.ConfigureContext;
024:
025:        @ConfigureContext(session=KHUNTLEY)
026:        public class PhoneNumberServiceTest extends KualiTestBase {
027:
028:            private PhoneNumberService phoneNumberService;
029:
030:            private final String phoneGenericFormat1 = "888-888-8888";
031:            private final String phoneGenericFormat2 = "(888) 888-8888";
032:            private final String phoneGenericFormat3 = "888 888 8888";
033:            private final String phoneGenericFaxFormat1 = "888,888-8888";
034:
035:            private final String phoneTooLong = "888-888-88888";
036:            private final String phoneTooShort = "888-888-888";
037:
038:            private final String phoneNonNumeric = "812-3EX-PRES";
039:            private final String phoneAllTogether = "8888888888";
040:
041:            protected void setUp() throws Exception {
042:                super .setUp();
043:                phoneNumberService = SpringContext
044:                        .getBean(PhoneNumberService.class);
045:            }
046:
047:            protected void tearDown() throws Exception {
048:                super .tearDown();
049:            }
050:
051:            public void testIsValidPhoneNumber_GenericFormat1() {
052:                assertTrue(phoneNumberService
053:                        .isValidPhoneNumber(phoneGenericFormat1));
054:            }
055:
056:            public void testIsValidPhoneNumber_GenericFormat2() {
057:                assertTrue(phoneNumberService
058:                        .isValidPhoneNumber(phoneGenericFormat2));
059:            }
060:
061:            public void testIsValidPhoneNumber_GenericFormat3() {
062:                assertTrue(phoneNumberService
063:                        .isValidPhoneNumber(phoneGenericFormat3));
064:            }
065:
066:            public void testIsValidPhoneNumber_GenericFaxFormat1() {
067:                assertFalse(phoneNumberService
068:                        .isValidPhoneNumber(phoneGenericFaxFormat1));
069:            }
070:
071:            public void testIsValidPhoneNumber_TooLong() {
072:                assertFalse(phoneNumberService.isValidPhoneNumber(phoneTooLong));
073:            }
074:
075:            public void testIsValidPhoneNumber_TooShort() {
076:                assertFalse(phoneNumberService
077:                        .isValidPhoneNumber(phoneTooShort));
078:            }
079:
080:            public void testIsValidPhoneNumber_NonNumeric() {
081:                assertFalse(phoneNumberService
082:                        .isValidPhoneNumber(phoneNonNumeric));
083:            }
084:
085:            public void testIsValidPhoneNumber_AllTogether() {
086:                assertFalse(phoneNumberService
087:                        .isValidPhoneNumber(phoneAllTogether));
088:            }
089:
090:            public void testIsDefaultFormatPhoneNumber_GenericFormat1() {
091:                assertTrue(phoneNumberService
092:                        .isDefaultFormatPhoneNumber(phoneGenericFormat1));
093:            }
094:
095:            public void testIsDefaultFormatPhoneNumber_GenericFormat3() {
096:                assertFalse(phoneNumberService
097:                        .isDefaultFormatPhoneNumber(phoneGenericFormat3));
098:            }
099:
100:            public void testFormatToDefaultGeneric_GenericFormat1() {
101:                assertEquals(phoneGenericFormat1, phoneNumberService
102:                        .formatNumberIfPossible(phoneGenericFormat1));
103:            }
104:
105:            public void testFormatToDefaultGeneric_GenericFormat2() {
106:                assertEquals(phoneGenericFormat1, phoneNumberService
107:                        .formatNumberIfPossible(phoneGenericFormat2));
108:            }
109:
110:            public void testFormatToDefaultGeneric_GenericFormat3() {
111:                assertEquals(phoneGenericFormat1, phoneNumberService
112:                        .formatNumberIfPossible(phoneGenericFormat3));
113:            }
114:
115:            public void testFormatToDefaultGeneric_GenericFaxFormat1() {
116:                assertEquals(phoneGenericFormat1, phoneNumberService
117:                        .formatNumberIfPossible(phoneGenericFaxFormat1));
118:            }
119:
120:            public void testFormatToDefaultGeneric_phoneTooShort() {
121:                boolean b = true;
122:                try {
123:                    b = phoneGenericFormat1.equals(phoneNumberService
124:                            .formatNumberIfPossible(phoneTooShort));
125:                } catch (FormatException fe) {
126:                    if (fe.getMessage().indexOf("fewer than") > 0) {
127:                        b = false;
128:                    }
129:                } finally {
130:                    assertEquals(b, false);
131:                }
132:            }
133:
134:            public void testFormatToDefaultGeneric_phoneTooLong() {
135:                boolean b = true;
136:                try {
137:                    b = phoneGenericFormat1.equals(phoneNumberService
138:                            .formatNumberIfPossible(phoneTooLong));
139:                } catch (FormatException fe) {
140:                    if (fe.getMessage().indexOf("more than") > 0) {
141:                        b = false;
142:                    }
143:                } finally {
144:                    assertEquals(b, false);
145:                }
146:            }
147:
148:            public void testFormatToDefaultGeneric_phoneNonNumeric() {
149:                boolean b = true;
150:                try {
151:                    b = phoneNumberService
152:                            .isDefaultFormatPhoneNumber(phoneNumberService
153:                                    .formatNumberIfPossible(phoneNonNumeric));
154:                } catch (FormatException fe) {
155:                    if (fe.getMessage().indexOf("fewer than") > 0) {
156:                        b = false;
157:                    }
158:                } finally {
159:                    assertEquals(b, false);
160:                }
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.