Source Code Cross Referenced for CollatorTest.java in  » Internationalization-Localization » icu4j » com » ibm » icu » tests » 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 » Internationalization Localization » icu4j » com.ibm.icu.tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *******************************************************************************
003:         * Copyright (C) 2006, International Business Machines Corporation and         *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */
007:
008:        package com.ibm.icu.tests;
009:
010:        import java.util.Locale;
011:
012:        import com.ibm.icu.text.CollationKey;
013:        import com.ibm.icu.text.Collator;
014:        import com.ibm.icu.util.ULocale;
015:
016:        public class CollatorTest extends ICUTestCase {
017:            private static final String s1 = "Fu\u0308nf"; // capital F + u + diaresis
018:            private static final String s2 = "fu\u0308nf"; // u + diaresis
019:            private static final String s3 = "f\u00fcnf"; // u-umlaut
020:            private static final String s4 = "fu\u0308\u0316nf"; // u + diaresis above + grave below
021:            private static final String s5 = "fu\u0316\u0308nf"; // u + grave below + diaresis above
022:
023:            /*
024:             * Test method for 'com.ibm.icu.text.Collator.hashCode()'
025:             */
026:            public void testHashCode() {
027:                Collator c = Collator.getInstance();
028:                c.setStrength(Collator.SECONDARY);
029:                Collator c2 = Collator.getInstance();
030:                c2.setStrength(Collator.SECONDARY);
031:                Collator cn = Collator.getInstance();
032:                cn.setStrength(Collator.TERTIARY);
033:                testEHCS(c, c2, cn);
034:            }
035:
036:            /*
037:             * Test method for 'com.ibm.icu.text.Collator.Collator(Collator)'
038:             */
039:            public void testCollator() {
040:                // implicitly tested everywhere
041:            }
042:
043:            /*
044:             * Test method for 'com.ibm.icu.text.Collator.setStrength(int)'
045:             */
046:            public void testSetStrength() {
047:                Collator c = Collator.getInstance();
048:                c.setStrength(Collator.PRIMARY);
049:                assertTrue(0 == c.compare(s1, s2));
050:                c.setStrength(Collator.SECONDARY);
051:                assertTrue(0 == c.compare(s1, s2));
052:                c.setStrength(Collator.TERTIARY);
053:                assertTrue(0 < c.compare(s1, s2));
054:                assertTrue(0 == c.compare(s2, s3));
055:                c.setStrength(Collator.QUATERNARY);
056:                assertTrue(0 > c.compare(s2, s3));
057:            }
058:
059:            /*
060:             * Test method for 'com.ibm.icu.text.Collator.setDecomposition(int)'
061:             */
062:            public void testSetDecomposition() {
063:                Collator c = Collator.getInstance();
064:                c.setStrength(Collator.TERTIARY);
065:                assertTrue(0 != c.compare(s4, s5));
066:                c.setDecomposition(Collator.IDENTICAL);
067:                assertTrue(0 == c.compare(s4, s5));
068:            }
069:
070:            /*
071:             * Test method for 'com.ibm.icu.text.Collator.getInstance()'
072:             */
073:            public void testGetInstance() {
074:                // implicitly tested everywhere
075:            }
076:
077:            /*
078:             * Test method for 'com.ibm.icu.text.Collator.getInstance(ULocale)'
079:             */
080:            public void testGetInstanceULocale() {
081:                Collator c = Collator.getInstance(ULocale.GERMANY);
082:                assertNotNull(c);
083:            }
084:
085:            /*
086:             * Test method for 'com.ibm.icu.text.Collator.getInstance(Locale)'
087:             */
088:            public void testGetInstanceLocale() {
089:                Collator c = Collator.getInstance(Locale.GERMANY);
090:                assertNotNull(c);
091:            }
092:
093:            /*
094:             * Test method for 'com.ibm.icu.text.Collator.getAvailableLocales()'
095:             */
096:            public void testGetAvailableLocales() {
097:                assertNotNull(Collator.getAvailableLocales());
098:            }
099:
100:            /*
101:             * Test method for 'com.ibm.icu.text.Collator.getAvailableULocales()'
102:             */
103:            public void testGetAvailableULocales() {
104:                assertNotNull(Collator.getAvailableULocales());
105:            }
106:
107:            /*
108:             * Test method for 'com.ibm.icu.text.Collator.getKeywords()'
109:             */
110:            public void testGetKeywords() {
111:                assertEquals(0, Collator.getKeywords().length);
112:            }
113:
114:            /*
115:             * Test method for 'com.ibm.icu.text.Collator.getKeywordValues(String)'
116:             */
117:            public void testGetKeywordValues() {
118:                assertEquals(0, Collator.getKeywordValues("").length);
119:            }
120:
121:            /*
122:             * Test method for 'com.ibm.icu.text.Collator.getStrength()'
123:             */
124:            public void testGetStrength() {
125:                Collator c = Collator.getInstance();
126:                c.setStrength(Collator.PRIMARY);
127:                assertEquals(Collator.PRIMARY, c.getStrength());
128:                c.setStrength(Collator.SECONDARY);
129:                assertEquals(Collator.SECONDARY, c.getStrength());
130:            }
131:
132:            /*
133:             * Test method for 'com.ibm.icu.text.Collator.getDecomposition()'
134:             */
135:            public void testGetDecomposition() {
136:                Collator c = Collator.getInstance();
137:                c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
138:                assertEquals(Collator.CANONICAL_DECOMPOSITION, c
139:                        .getDecomposition());
140:                c.setDecomposition(Collator.NO_DECOMPOSITION);
141:                assertEquals(Collator.NO_DECOMPOSITION, c.getDecomposition());
142:            }
143:
144:            /*
145:             * Test method for 'com.ibm.icu.text.Collator.compare(Object, Object)'
146:             */
147:            public void testCompareObjectObject() {
148:                Collator c = Collator.getInstance();
149:                c.setStrength(Collator.PRIMARY);
150:                assertTrue(0 == c.compare((Object) s1, (Object) s2));
151:            }
152:
153:            /*
154:             * Test method for 'com.ibm.icu.text.Collator.equals(String, String)'
155:             */
156:            public void testEqualsStringString() {
157:                Collator c = Collator.getInstance();
158:                c.setStrength(Collator.PRIMARY);
159:                assertTrue(c.equals(s1, s2));
160:            }
161:
162:            /*
163:             * Test method for 'com.ibm.icu.text.Collator.compare(String, String)'
164:             */
165:            public void testCompareStringString() {
166:                Collator c = Collator.getInstance();
167:                c.setStrength(Collator.PRIMARY);
168:                assertTrue(0 == c.compare(s1, s2));
169:            }
170:
171:            /*
172:             * Test method for 'com.ibm.icu.text.Collator.getCollationKey(String)'
173:             */
174:            public void testGetCollationKey() {
175:                Collator c = Collator.getInstance();
176:                c.setStrength(Collator.PRIMARY);
177:                CollationKey k1 = c.getCollationKey(s1);
178:                CollationKey k2 = c.getCollationKey(s2);
179:                assertTrue(k1.equals(k2));
180:                c.setStrength(Collator.TERTIARY);
181:                k1 = c.getCollationKey(s1);
182:                k2 = c.getCollationKey(s2);
183:                assertFalse(k1.equals(k2));
184:            }
185:
186:            /*
187:             * Test method for 'com.ibm.icu.text.Collator.toString()'
188:             */
189:            public void testToString() {
190:                assertNotNull(Collator.getInstance().toString());
191:            }
192:
193:            /*
194:             * Test method for 'com.ibm.icu.text.Collator.clone()'
195:             */
196:            public void testClone() {
197:                // tested above
198:            }
199:
200:            /*
201:             * Test method for 'com.ibm.icu.text.Collator.equals(Object)'
202:             */
203:            public void testEqualsObject() {
204:                // tested above
205:            }
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.