< prev index next >

test/jdk/java/text/Collator/APITest.java

Print this page

  1 /*
  2  * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 /*
 25  * @test
 26  * @library /java/text/testlib
 27  * @summary test Collation API
 28  * @modules jdk.localedata
 29  */
 30 /*
 31 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
 32 (C) Copyright IBM Corp. 1996 - All Rights Reserved
 33 
 34   The original version of this source code and documentation is copyrighted and
 35 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
 36 provided under terms of a License Agreement between Taligent and Sun. This
 37 technology is protected by multiple US and International patents. This notice and
 38 attribution to Taligent may not be removed.
 39   Taligent is a registered trademark of Taligent, Inc.
 40 */
 41 








 42 import java.util.Locale;
 43 import java.text.Collator;
 44 import java.text.RuleBasedCollator;
 45 import java.text.CollationKey;
 46 import java.text.CollationElementIterator;
 47 
 48 public class APITest extends CollatorTest {
 49 
 50     public static void main(String[] args) throws Exception {
 51         new APITest().run(args);
 52     }
 53 
 54     final void doAssert(boolean condition, String message)
 55     {
 56         if (!condition) {
 57             err("ERROR: ");
 58             errln(message);
 59         }
 60     }
 61 

 62     public final void TestProperty( )
 63     {
 64         Collator col = null;
 65         try {
 66             col = Collator.getInstance(Locale.ROOT);
 67             logln("The property tests begin : ");
 68             logln("Test ctors : ");
 69             doAssert(col.compare("ab", "abc") < 0, "ab < abc comparison failed");
 70             doAssert(col.compare("ab", "AB") < 0, "ab < AB comparison failed");
 71             doAssert(col.compare("black-bird", "blackbird") > 0, "black-bird > blackbird comparison failed");
 72             doAssert(col.compare("black bird", "black-bird") < 0, "black bird < black-bird comparison failed");
 73             doAssert(col.compare("Hello", "hello") > 0, "Hello > hello comparison failed");
 74 
 75             logln("Test ctors ends.");
 76             logln("testing Collator.getStrength() method ...");
 77             doAssert(col.getStrength() == Collator.TERTIARY, "collation object has the wrong strength");
 78             doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
 79 
 80             logln("testing Collator.setStrength() method ...");
 81             col.setStrength(Collator.SECONDARY);
 82             doAssert(col.getStrength() != Collator.TERTIARY, "collation object's strength is secondary difference");
 83             doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
 84             doAssert(col.getStrength() == Collator.SECONDARY, "collation object has the wrong strength");
 85 
 86             logln("testing Collator.setDecomposition() method ...");
 87             col.setDecomposition(Collator.NO_DECOMPOSITION);
 88             doAssert(col.getDecomposition() != Collator.FULL_DECOMPOSITION, "collation object's strength is secondary difference");
 89             doAssert(col.getDecomposition() != Collator.CANONICAL_DECOMPOSITION, "collation object's strength is primary difference");
 90             doAssert(col.getDecomposition() == Collator.NO_DECOMPOSITION, "collation object has the wrong strength");
 91         } catch (Exception foo) {
 92             errln("Error : " + foo.getMessage());
 93             errln("Default Collator creation failed.");
 94         }
 95         logln("Default collation property test ended.");
 96         logln("Collator.getRules() testing ...");
 97         doAssert(((RuleBasedCollator)col).getRules().length() != 0, "getRules() result incorrect" );
 98         logln("getRules tests end.");
 99         try {
100             col = Collator.getInstance(Locale.FRENCH);
101             col.setStrength(Collator.PRIMARY);
102             logln("testing Collator.getStrength() method again ...");
103             doAssert(col.getStrength() != Collator.TERTIARY, "collation object has the wrong strength");
104             doAssert(col.getStrength() == Collator.PRIMARY, "collation object's strength is not primary difference");
105 
106             logln("testing French Collator.setStrength() method ...");
107             col.setStrength(Collator.TERTIARY);
108             doAssert(col.getStrength() == Collator.TERTIARY, "collation object's strength is not tertiary difference");
109             doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
110             doAssert(col.getStrength() != Collator.SECONDARY, "collation object's strength is secondary difference");
111 
112         } catch (Exception bar) {
113             errln("Error :  " + bar.getMessage());
114             errln("Creating French collation failed.");
115         }
116 
117         logln("Create junk collation: ");
118         Locale abcd = Locale.of("ab", "CD");
119         Collator junk = null;
120         try {
121             junk = Collator.getInstance(abcd);
122         } catch (Exception err) {
123             errln("Error : " + err.getMessage());
124             errln("Junk collation creation failed, should at least return the collator for the base bundle.");
125         }
126         try {
127             col = Collator.getInstance(Locale.ROOT);
128             doAssert(col.equals(junk), "The base bundle's collation should be returned.");
129         } catch (Exception exc) {
130             errln("Error : " + exc.getMessage());
131             errln("Default collation comparison, caching not working.");
132         }
133 
134         logln("Collator property test ended.");
135     }
136 

137     public final void TestHashCode( )
138     {
139         logln("hashCode tests begin.");
140         Collator col1 = null;
141         try {
142             col1 = Collator.getInstance(Locale.ROOT);
143         } catch (Exception foo) {
144             errln("Error : " + foo.getMessage());
145             errln("Default collation creation failed.");
146         }
147         Collator col2 = null;
148         Locale dk = Locale.of("da", "DK");
149         try {
150             col2 = Collator.getInstance(dk);
151         } catch (Exception bar) {
152             errln("Error : " + bar.getMessage());
153             errln("Danish collation creation failed.");
154             return;
155         }
156         Collator col3 = null;
157         try {
158             col3 = Collator.getInstance(Locale.ROOT);
159         } catch (Exception err) {
160             errln("Error : " + err.getMessage());
161             errln("2nd default collation creation failed.");
162         }
163         logln("Collator.hashCode() testing ...");
164 
165         if (col1 != null) {
166             doAssert(col1.hashCode() != col2.hashCode(), "Hash test1 result incorrect");
167             if (col3 != null) {
168                 doAssert(col1.hashCode() == col3.hashCode(), "Hash result not equal");
169             }
170         }
171 
172         logln("hashCode tests end.");
173     }
174 
175     //----------------------------------------------------------------------------
176     // ctor -- Tests the constructor methods
177     //

178     public final void TestCollationKey( )
179     {
180         logln("testing CollationKey begins...");
181         Collator col = null;
182         try {
183             col = Collator.getInstance(Locale.ROOT);
184         } catch (Exception foo) {
185             errln("Error : " + foo.getMessage());
186             errln("Default collation creation failed.");
187         }
188         if (col == null) {
189             return;
190         }
191 
192         String test1 = "Abcda", test2 = "abcda";
193         logln("Use tertiary comparison level testing ....");
194         CollationKey sortk1 = col.getCollationKey(test1);
195         CollationKey sortk2 = col.getCollationKey(test2);
196         doAssert(sortk1.compareTo(sortk2) > 0,
197                     "Result should be \"Abcda\" >>> \"abcda\"");
198         CollationKey sortk3 = sortk2;
199         CollationKey sortkNew = sortk1;
200         doAssert(sortk1 != sortk2, "The sort keys should be different");
201         doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
202         doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
203         doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
204         doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
205         doAssert(sortkNew != sortk3, "The sort keys should be different");
206         doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
207         doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
208         long    cnt1, cnt2;
209         byte byteArray1[] = sortk1.toByteArray();
210         byte byteArray2[] = sortk2.toByteArray();
211         doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
212         logln("testing sortkey ends...");
213     }
214     //----------------------------------------------------------------------------
215     // ctor -- Tests the constructor methods
216     //

217     public final void TestElemIter( )
218     {
219         logln("testing sortkey begins...");
220         Collator col = null;
221         try {
222             col = Collator.getInstance();
223         } catch (Exception foo) {
224             errln("Error : " + foo.getMessage());
225             errln("Default collation creation failed.");
226         }
227         RuleBasedCollator rbCol;
228         if (col instanceof RuleBasedCollator) {
229             rbCol = (RuleBasedCollator) col;
230         } else {
231             return;
232         }
233         String testString1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?";
234         String testString2 = "Xf ile What subset of all possible test cases has the lowest probability of detecting the least errors?";
235         logln("Constructors and comparison testing....");
236         CollationElementIterator iterator1 = rbCol.getCollationElementIterator(testString1);
237         CollationElementIterator iterator2 = rbCol.getCollationElementIterator(testString1);
238         CollationElementIterator iterator3 = rbCol.getCollationElementIterator(testString2);
239         int order1, order2, order3;
240         order1 = iterator1.next();
241         order2 = iterator2.next();
242         doAssert(order1 == order2, "The order result should be the same");
243 
244         order3 = iterator3.next();
245         doAssert(CollationElementIterator.primaryOrder(order1)
246                      == CollationElementIterator.primaryOrder(order3),
247                  "The primary orders should be the same");
248         doAssert(CollationElementIterator.secondaryOrder(order1)
249                      == CollationElementIterator.secondaryOrder(order3),
250                  "The secondary orders should be the same");
251         doAssert(CollationElementIterator.tertiaryOrder(order1)
252                      == CollationElementIterator.tertiaryOrder(order3),
253                  "The tertiary orders should be the same");
254 
255         order1 = iterator1.next();

286         doAssert(CollationElementIterator.tertiaryOrder(order1)
287                      == CollationElementIterator.tertiaryOrder(order3),
288                  "The orders should be the same");
289 
290         order1 = iterator1.next();
291         order2 = iterator2.next();
292         order3 = iterator3.next();
293         doAssert(CollationElementIterator.primaryOrder(order1)
294                      == CollationElementIterator.primaryOrder(order3),
295                  "The primary orders should be identical");
296         doAssert(CollationElementIterator.tertiaryOrder(order1)
297                      != CollationElementIterator.tertiaryOrder(order3),
298                  "The tertiary orders should be different");
299 
300         order1 = iterator1.next();
301         order3 = iterator3.next();
302         doAssert(CollationElementIterator.secondaryOrder(order1)
303                      != CollationElementIterator.secondaryOrder(order3),
304                  "The secondary orders should be different");
305         doAssert(order1 != CollationElementIterator.NULLORDER, "Unexpected end of iterator reached");
306         logln("testing CollationElementIterator ends...");
307     }
308 

309     public final void TestGetAll()
310     {
311         Locale[] list = Collator.getAvailableLocales();
312         for (int i = 0; i < list.length; ++i) {
313             log("Locale name: ");
314             log(list[i].toString());
315             log(" , the display name is : ");
316             logln(list[i].getDisplayName());
317         }
318     }
319 }

  1 /*
  2  * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 






 24 /*
 25 (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
 26 (C) Copyright IBM Corp. 1996 - All Rights Reserved
 27 
 28   The original version of this source code and documentation is copyrighted and
 29 owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
 30 provided under terms of a License Agreement between Taligent and Sun. This
 31 technology is protected by multiple US and International patents. This notice and
 32 attribution to Taligent may not be removed.
 33   Taligent is a registered trademark of Taligent, Inc.
 34 */
 35 
 36 /*
 37  * @test
 38  * @library /java/text/testlib
 39  * @summary test Collation API
 40  * @modules jdk.localedata
 41  * @run junit APITest
 42  */
 43 
 44 import java.util.Locale;
 45 import java.text.Collator;
 46 import java.text.RuleBasedCollator;
 47 import java.text.CollationKey;
 48 import java.text.CollationElementIterator;
 49 
 50 import org.junit.jupiter.api.Test;
 51 
 52 import static org.junit.jupiter.api.Assertions.fail;
 53 
 54 public class APITest {
 55 
 56     final void doAssert(boolean condition, String message)
 57     {
 58         if (!condition) {
 59             fail("ERROR: " + message);

 60         }
 61     }
 62 
 63     @Test
 64     public final void TestProperty( )
 65     {
 66         Collator col = null;
 67         try {
 68             col = Collator.getInstance(Locale.ROOT);
 69             System.out.println("The property tests begin : ");
 70             System.out.println("Test ctors : ");
 71             doAssert(col.compare("ab", "abc") < 0, "ab < abc comparison failed");
 72             doAssert(col.compare("ab", "AB") < 0, "ab < AB comparison failed");
 73             doAssert(col.compare("black-bird", "blackbird") > 0, "black-bird > blackbird comparison failed");
 74             doAssert(col.compare("black bird", "black-bird") < 0, "black bird < black-bird comparison failed");
 75             doAssert(col.compare("Hello", "hello") > 0, "Hello > hello comparison failed");
 76 
 77             System.out.println("Test ctors ends.");
 78             System.out.println("testing Collator.getStrength() method ...");
 79             doAssert(col.getStrength() == Collator.TERTIARY, "collation object has the wrong strength");
 80             doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
 81 
 82             System.out.println("testing Collator.setStrength() method ...");
 83             col.setStrength(Collator.SECONDARY);
 84             doAssert(col.getStrength() != Collator.TERTIARY, "collation object's strength is secondary difference");
 85             doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
 86             doAssert(col.getStrength() == Collator.SECONDARY, "collation object has the wrong strength");
 87 
 88             System.out.println("testing Collator.setDecomposition() method ...");
 89             col.setDecomposition(Collator.NO_DECOMPOSITION);
 90             doAssert(col.getDecomposition() != Collator.FULL_DECOMPOSITION, "collation object's strength is secondary difference");
 91             doAssert(col.getDecomposition() != Collator.CANONICAL_DECOMPOSITION, "collation object's strength is primary difference");
 92             doAssert(col.getDecomposition() == Collator.NO_DECOMPOSITION, "collation object has the wrong strength");
 93         } catch (Exception foo) {
 94             fail("Error : " + foo.getMessage()
 95             + "\n Default Collator creation failed.");
 96         }
 97         System.out.println("Default collation property test ended.");
 98         System.out.println("Collator.getRules() testing ...");
 99         doAssert(((RuleBasedCollator)col).getRules().length() != 0, "getRules() result incorrect" );
100         System.out.println("getRules tests end.");
101         try {
102             col = Collator.getInstance(Locale.FRENCH);
103             col.setStrength(Collator.PRIMARY);
104             System.out.println("testing Collator.getStrength() method again ...");
105             doAssert(col.getStrength() != Collator.TERTIARY, "collation object has the wrong strength");
106             doAssert(col.getStrength() == Collator.PRIMARY, "collation object's strength is not primary difference");
107 
108             System.out.println("testing French Collator.setStrength() method ...");
109             col.setStrength(Collator.TERTIARY);
110             doAssert(col.getStrength() == Collator.TERTIARY, "collation object's strength is not tertiary difference");
111             doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
112             doAssert(col.getStrength() != Collator.SECONDARY, "collation object's strength is secondary difference");
113 
114         } catch (Exception bar) {
115             fail("Error :  " + bar.getMessage()
116             + "\n Creating French collation failed.");
117         }
118 
119         System.out.println("Create junk collation: ");
120         Locale abcd = Locale.of("ab", "CD");
121         Collator junk = null;
122         try {
123             junk = Collator.getInstance(abcd);
124         } catch (Exception err) {
125             fail("Error : " + err.getMessage()
126             + "\n Junk collation creation failed, should at least return the collator for the base bundle.");
127         }
128         try {
129             col = Collator.getInstance(Locale.ROOT);
130             doAssert(col.equals(junk), "The base bundle's collation should be returned.");
131         } catch (Exception exc) {
132             fail("Error : " + exc.getMessage()
133             + "\n Default collation comparison, caching not working.");
134         }
135 
136         System.out.println("Collator property test ended.");
137     }
138 
139     @Test
140     public final void TestHashCode( )
141     {
142         System.out.println("hashCode tests begin.");
143         Collator col1 = null;
144         try {
145             col1 = Collator.getInstance(Locale.ROOT);
146         } catch (Exception foo) {
147             fail("Error : " + foo.getMessage()
148             + "\n Default collation creation failed.");
149         }
150         Collator col2 = null;
151         Locale dk = Locale.of("da", "DK");
152         try {
153             col2 = Collator.getInstance(dk);
154         } catch (Exception bar) {
155             fail("Error : " + bar.getMessage()
156             + "\n Danish collation creation failed.");
157             return;
158         }
159         Collator col3 = null;
160         try {
161             col3 = Collator.getInstance(Locale.ROOT);
162         } catch (Exception err) {
163             fail("Error : " + err.getMessage()
164             + "\n 2nd default collation creation failed.");
165         }
166         System.out.println("Collator.hashCode() testing ...");
167 
168         if (col1 != null) {
169             doAssert(col1.hashCode() != col2.hashCode(), "Hash test1 result incorrect");
170             if (col3 != null) {
171                 doAssert(col1.hashCode() == col3.hashCode(), "Hash result not equal");
172             }
173         }
174 
175         System.out.println("hashCode tests end.");
176     }
177 
178     //----------------------------------------------------------------------------
179     // ctor -- Tests the constructor methods
180     //
181     @Test
182     public final void TestCollationKey( )
183     {
184         System.out.println("testing CollationKey begins...");
185         Collator col = null;
186         try {
187             col = Collator.getInstance(Locale.ROOT);
188         } catch (Exception foo) {
189             fail("Error : " + foo.getMessage()
190             + "\n Default collation creation failed.");
191         }
192         if (col == null) {
193             return;
194         }
195 
196         String test1 = "Abcda", test2 = "abcda";
197         System.out.println("Use tertiary comparison level testing ....");
198         CollationKey sortk1 = col.getCollationKey(test1);
199         CollationKey sortk2 = col.getCollationKey(test2);
200         doAssert(sortk1.compareTo(sortk2) > 0,
201                     "Result should be \"Abcda\" >>> \"abcda\"");
202         CollationKey sortk3 = sortk2;
203         CollationKey sortkNew = sortk1;
204         doAssert(sortk1 != sortk2, "The sort keys should be different");
205         doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
206         doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
207         doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
208         doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
209         doAssert(sortkNew != sortk3, "The sort keys should be different");
210         doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
211         doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
212         long    cnt1, cnt2;
213         byte byteArray1[] = sortk1.toByteArray();
214         byte byteArray2[] = sortk2.toByteArray();
215         doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
216         System.out.println("testing sortkey ends...");
217     }
218     //----------------------------------------------------------------------------
219     // ctor -- Tests the constructor methods
220     //
221     @Test
222     public final void TestElemIter( )
223     {
224         System.out.println("testing sortkey begins...");
225         Collator col = null;
226         try {
227             col = Collator.getInstance();
228         } catch (Exception foo) {
229             fail("Error : " + foo.getMessage()
230             + "\n Default collation creation failed.");
231         }
232         RuleBasedCollator rbCol;
233         if (col instanceof RuleBasedCollator) {
234             rbCol = (RuleBasedCollator) col;
235         } else {
236             return;
237         }
238         String testString1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?";
239         String testString2 = "Xf ile What subset of all possible test cases has the lowest probability of detecting the least errors?";
240         System.out.println("Constructors and comparison testing....");
241         CollationElementIterator iterator1 = rbCol.getCollationElementIterator(testString1);
242         CollationElementIterator iterator2 = rbCol.getCollationElementIterator(testString1);
243         CollationElementIterator iterator3 = rbCol.getCollationElementIterator(testString2);
244         int order1, order2, order3;
245         order1 = iterator1.next();
246         order2 = iterator2.next();
247         doAssert(order1 == order2, "The order result should be the same");
248 
249         order3 = iterator3.next();
250         doAssert(CollationElementIterator.primaryOrder(order1)
251                      == CollationElementIterator.primaryOrder(order3),
252                  "The primary orders should be the same");
253         doAssert(CollationElementIterator.secondaryOrder(order1)
254                      == CollationElementIterator.secondaryOrder(order3),
255                  "The secondary orders should be the same");
256         doAssert(CollationElementIterator.tertiaryOrder(order1)
257                      == CollationElementIterator.tertiaryOrder(order3),
258                  "The tertiary orders should be the same");
259 
260         order1 = iterator1.next();

291         doAssert(CollationElementIterator.tertiaryOrder(order1)
292                      == CollationElementIterator.tertiaryOrder(order3),
293                  "The orders should be the same");
294 
295         order1 = iterator1.next();
296         order2 = iterator2.next();
297         order3 = iterator3.next();
298         doAssert(CollationElementIterator.primaryOrder(order1)
299                      == CollationElementIterator.primaryOrder(order3),
300                  "The primary orders should be identical");
301         doAssert(CollationElementIterator.tertiaryOrder(order1)
302                      != CollationElementIterator.tertiaryOrder(order3),
303                  "The tertiary orders should be different");
304 
305         order1 = iterator1.next();
306         order3 = iterator3.next();
307         doAssert(CollationElementIterator.secondaryOrder(order1)
308                      != CollationElementIterator.secondaryOrder(order3),
309                  "The secondary orders should be different");
310         doAssert(order1 != CollationElementIterator.NULLORDER, "Unexpected end of iterator reached");
311         System.out.println("testing CollationElementIterator ends...");
312     }
313 
314     @Test
315     public final void TestGetAll()
316     {
317         Locale[] list = Collator.getAvailableLocales();
318         for (int i = 0; i < list.length; ++i) {
319             System.out.println("Locale name: ");
320             System.out.println(list[i].toString());
321             System.out.println(" , the display name is : ");
322             System.out.println(list[i].getDisplayName());
323         }
324     }
325 }
< prev index next >