|
1 | 1 | /* |
2 | | - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -64,103 +64,103 @@ public final void TestProperty( ) |
64 | 64 | Collator col = null; |
65 | 65 | try { |
66 | 66 | col = Collator.getInstance(Locale.ROOT); |
67 | | - logln("The property tests begin : "); |
68 | | - logln("Test ctors : "); |
| 67 | + System.out.println("The property tests begin : "); |
| 68 | + System.out.println("Test ctors : "); |
69 | 69 | doAssert(col.compare("ab", "abc") < 0, "ab < abc comparison failed"); |
70 | 70 | doAssert(col.compare("ab", "AB") < 0, "ab < AB comparison failed"); |
71 | 71 | doAssert(col.compare("black-bird", "blackbird") > 0, "black-bird > blackbird comparison failed"); |
72 | 72 | doAssert(col.compare("black bird", "black-bird") < 0, "black bird < black-bird comparison failed"); |
73 | 73 | doAssert(col.compare("Hello", "hello") > 0, "Hello > hello comparison failed"); |
74 | 74 |
|
75 | | - logln("Test ctors ends."); |
76 | | - logln("testing Collator.getStrength() method ..."); |
| 75 | + System.out.println("Test ctors ends."); |
| 76 | + System.out.println("testing Collator.getStrength() method ..."); |
77 | 77 | doAssert(col.getStrength() == Collator.TERTIARY, "collation object has the wrong strength"); |
78 | 78 | doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference"); |
79 | 79 |
|
80 | | - logln("testing Collator.setStrength() method ..."); |
| 80 | + System.out.println("testing Collator.setStrength() method ..."); |
81 | 81 | col.setStrength(Collator.SECONDARY); |
82 | 82 | doAssert(col.getStrength() != Collator.TERTIARY, "collation object's strength is secondary difference"); |
83 | 83 | doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference"); |
84 | 84 | doAssert(col.getStrength() == Collator.SECONDARY, "collation object has the wrong strength"); |
85 | 85 |
|
86 | | - logln("testing Collator.setDecomposition() method ..."); |
| 86 | + System.out.println("testing Collator.setDecomposition() method ..."); |
87 | 87 | col.setDecomposition(Collator.NO_DECOMPOSITION); |
88 | 88 | doAssert(col.getDecomposition() != Collator.FULL_DECOMPOSITION, "collation object's strength is secondary difference"); |
89 | 89 | doAssert(col.getDecomposition() != Collator.CANONICAL_DECOMPOSITION, "collation object's strength is primary difference"); |
90 | 90 | doAssert(col.getDecomposition() == Collator.NO_DECOMPOSITION, "collation object has the wrong strength"); |
91 | 91 | } catch (Exception foo) { |
92 | | - errln("Error : " + foo.getMessage()); |
93 | | - errln("Default Collator creation failed."); |
| 92 | + fail("Error : " + foo.getMessage() |
| 93 | + + "\n Default Collator creation failed."); |
94 | 94 | } |
95 | | - logln("Default collation property test ended."); |
96 | | - logln("Collator.getRules() testing ..."); |
| 95 | + System.out.println("Default collation property test ended."); |
| 96 | + System.out.println("Collator.getRules() testing ..."); |
97 | 97 | doAssert(((RuleBasedCollator)col).getRules().length() != 0, "getRules() result incorrect" ); |
98 | | - logln("getRules tests end."); |
| 98 | + System.out.println("getRules tests end."); |
99 | 99 | try { |
100 | 100 | col = Collator.getInstance(Locale.FRENCH); |
101 | 101 | col.setStrength(Collator.PRIMARY); |
102 | | - logln("testing Collator.getStrength() method again ..."); |
| 102 | + System.out.println("testing Collator.getStrength() method again ..."); |
103 | 103 | doAssert(col.getStrength() != Collator.TERTIARY, "collation object has the wrong strength"); |
104 | 104 | doAssert(col.getStrength() == Collator.PRIMARY, "collation object's strength is not primary difference"); |
105 | 105 |
|
106 | | - logln("testing French Collator.setStrength() method ..."); |
| 106 | + System.out.println("testing French Collator.setStrength() method ..."); |
107 | 107 | col.setStrength(Collator.TERTIARY); |
108 | 108 | doAssert(col.getStrength() == Collator.TERTIARY, "collation object's strength is not tertiary difference"); |
109 | 109 | doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference"); |
110 | 110 | doAssert(col.getStrength() != Collator.SECONDARY, "collation object's strength is secondary difference"); |
111 | 111 |
|
112 | 112 | } catch (Exception bar) { |
113 | | - errln("Error : " + bar.getMessage()); |
114 | | - errln("Creating French collation failed."); |
| 113 | + fail("Error : " + bar.getMessage() |
| 114 | + + "\n Creating French collation failed."); |
115 | 115 | } |
116 | 116 |
|
117 | | - logln("Create junk collation: "); |
| 117 | + System.out.println("Create junk collation: "); |
118 | 118 | Locale abcd = new Locale("ab", "CD", ""); |
119 | 119 | Collator junk = null; |
120 | 120 | try { |
121 | 121 | junk = Collator.getInstance(abcd); |
122 | 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."); |
| 123 | + fail("Error : " + err.getMessage() |
| 124 | + + "\n Junk collation creation failed, should at least return the collator for the base bundle."); |
125 | 125 | } |
126 | 126 | try { |
127 | 127 | col = Collator.getInstance(Locale.ROOT); |
128 | 128 | doAssert(col.equals(junk), "The base bundle's collation should be returned."); |
129 | 129 | } catch (Exception exc) { |
130 | | - errln("Error : " + exc.getMessage()); |
131 | | - errln("Default collation comparison, caching not working."); |
| 130 | + fail("Error : " + exc.getMessage() |
| 131 | + + "\n Default collation comparison, caching not working."); |
132 | 132 | } |
133 | 133 |
|
134 | | - logln("Collator property test ended."); |
| 134 | + System.out.println("Collator property test ended."); |
135 | 135 | } |
136 | 136 |
|
137 | 137 | public final void TestHashCode( ) |
138 | 138 | { |
139 | | - logln("hashCode tests begin."); |
| 139 | + System.out.println("hashCode tests begin."); |
140 | 140 | Collator col1 = null; |
141 | 141 | try { |
142 | 142 | col1 = Collator.getInstance(Locale.ROOT); |
143 | 143 | } catch (Exception foo) { |
144 | | - errln("Error : " + foo.getMessage()); |
145 | | - errln("Default collation creation failed."); |
| 144 | + fail("Error : " + foo.getMessage() |
| 145 | + + "\n Default collation creation failed."); |
146 | 146 | } |
147 | 147 | Collator col2 = null; |
148 | 148 | Locale dk = new Locale("da", "DK", ""); |
149 | 149 | try { |
150 | 150 | col2 = Collator.getInstance(dk); |
151 | 151 | } catch (Exception bar) { |
152 | | - errln("Error : " + bar.getMessage()); |
153 | | - errln("Danish collation creation failed."); |
| 152 | + fail("Error : " + bar.getMessage() |
| 153 | + + "\n Danish collation creation failed."); |
154 | 154 | return; |
155 | 155 | } |
156 | 156 | Collator col3 = null; |
157 | 157 | try { |
158 | 158 | col3 = Collator.getInstance(Locale.ROOT); |
159 | 159 | } catch (Exception err) { |
160 | | - errln("Error : " + err.getMessage()); |
161 | | - errln("2nd default collation creation failed."); |
| 160 | + fail("Error : " + err.getMessage() |
| 161 | + + "\n 2nd default collation creation failed."); |
162 | 162 | } |
163 | | - logln("Collator.hashCode() testing ..."); |
| 163 | + System.out.println("Collator.hashCode() testing ..."); |
164 | 164 |
|
165 | 165 | if (col1 != null) { |
166 | 166 | doAssert(col1.hashCode() != col2.hashCode(), "Hash test1 result incorrect"); |
|
0 commit comments