author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 38581 | jdk/test/java/text/Format/common/Bug6215962.java@e761c1ccd13e |
permissions | -rw-r--r-- |
38581
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
1 |
/* |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
2 |
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
4 |
* |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
8 |
* |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
13 |
* accompanied this code). |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
14 |
* |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
18 |
* |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
21 |
* questions. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
22 |
*/ |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
23 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
24 |
/* |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
25 |
* @test |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
26 |
* @bug 6215962 |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
27 |
* @summary Confirm that replacing Utility.arayEquals methods have with |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
28 |
* Arrays.equals introduces no problem. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
29 |
*/ |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
30 |
import java.text.*; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
31 |
import java.util.*; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
32 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
33 |
public class Bug6215962 { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
34 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
35 |
public static void main(String[] args) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
36 |
testMessageFormat(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
37 |
testChoiceFormat(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
38 |
testDateFormatSymbols(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
39 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
40 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
41 |
/** |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
42 |
* Test cases for MessageFormat |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
43 |
*/ |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
44 |
static void testMessageFormat() { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
45 |
MessageFormat mf1 = new MessageFormat("{0}", null); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
46 |
MessageFormat mf2 = new MessageFormat("{0}", null); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
47 |
check(mf1, mf2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
48 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
49 |
mf1.setLocale(null); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
50 |
check(mf1, mf2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
51 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
52 |
mf1 = new MessageFormat("{0}", Locale.US); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
53 |
check(mf1, mf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
54 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
55 |
mf2 = new MessageFormat("{0}", Locale.JAPAN); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
56 |
check(mf1, mf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
57 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
58 |
mf1 = new MessageFormat("{0}", new Locale("ja", "JP")); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
59 |
check(mf1, mf2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
60 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
61 |
mf1.setLocale(null); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
62 |
check(mf1, mf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
63 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
64 |
mf1 = new MessageFormat("{0}", new Locale("ja", "JP", "FOO")); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
65 |
check(mf1, mf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
66 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
67 |
mf2 = new MessageFormat("{1}", new Locale("ja", "JP", "FOO")); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
68 |
check(mf1, mf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
69 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
70 |
mf1 = new MessageFormat("{1}", new Locale("ja", "JP", "FOO")); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
71 |
check(mf1, mf2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
72 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
73 |
mf1 = new MessageFormat("{1, date}", new Locale("ja", "JP", "FOO")); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
74 |
check(mf1, mf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
75 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
76 |
mf2 = new MessageFormat("{1, date}", new Locale("ja", "JP", "FOO")); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
77 |
check(mf1, mf2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
78 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
79 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
80 |
static void check(MessageFormat f1, MessageFormat f2, boolean expected) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
81 |
boolean got = f1.equals(f2); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
82 |
if (got != expected) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
83 |
throw new RuntimeException("Test failed for MessageFormat.equals(). Got: " + got + ", Expected: " + expected); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
84 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
85 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
86 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
87 |
/** |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
88 |
* Test cases for MessageFormat |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
89 |
*/ |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
90 |
static void testChoiceFormat() { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
91 |
double[] limits0 = {0,1,2,3,4,5,6}; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
92 |
double[] limits1 = {1,2,3,4,5,6,7}; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
93 |
String[] monthNames0 = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
94 |
String[] monthNames1 = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
95 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
96 |
ChoiceFormat cf1 = new ChoiceFormat(limits1, monthNames0); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
97 |
ChoiceFormat cf2 = new ChoiceFormat(limits1, monthNames0); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
98 |
check(cf1, cf2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
99 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
100 |
cf2 = new ChoiceFormat(limits0, monthNames0); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
101 |
check(cf1, cf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
102 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
103 |
cf2 = new ChoiceFormat(limits1, monthNames1); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
104 |
check(cf1, cf2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
105 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
106 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
107 |
static void check(ChoiceFormat f1, ChoiceFormat f2, boolean expected) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
108 |
boolean got = f1.equals(f2); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
109 |
if (got != expected) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
110 |
throw new RuntimeException("Test failed for ChoiceFormat.equals(). Got: " + got + ", Expected: " + expected); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
111 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
112 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
113 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
114 |
/** |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
115 |
* Test cases for DateFormatSymbols |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
116 |
*/ |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
117 |
static void testDateFormatSymbols() { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
118 |
DateFormatSymbols dfs1 = new DateFormatSymbols(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
119 |
DateFormatSymbols dfs2 = new DateFormatSymbols(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
120 |
check(dfs1, dfs2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
121 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
122 |
// Becase eras, months, shortmonths, weekdays, shortweekdays, ampms are |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
123 |
// the same data type (String[]) and are treated in the same way, here |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
124 |
// I test only Months. |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
125 |
String[] tmp = dfs1.getMonths(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
126 |
String saved = tmp[0]; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
127 |
tmp[0] = "Foo"; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
128 |
dfs1.setMonths(tmp); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
129 |
check(dfs1, dfs2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
130 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
131 |
tmp[0] = saved; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
132 |
dfs1.setMonths(tmp); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
133 |
check(dfs1, dfs2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
134 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
135 |
// Test LocalizedpatternChars (String) |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
136 |
String pattern = dfs2.getLocalPatternChars(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
137 |
dfs2.setLocalPatternChars("Bar"); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
138 |
check(dfs1, dfs2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
139 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
140 |
dfs2.setLocalPatternChars(pattern); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
141 |
check(dfs1, dfs2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
142 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
143 |
// Test TimeZone strings (String[][]) |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
144 |
String[][] zones = dfs1.getZoneStrings(); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
145 |
saved = zones[0][1]; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
146 |
zones[0][1] = "Yokohama Summer Time"; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
147 |
dfs1.setZoneStrings(zones); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
148 |
check(dfs1, dfs2, false); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
149 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
150 |
zones[0][1] = saved; |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
151 |
dfs1.setZoneStrings(zones); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
152 |
check(dfs1, dfs2, true); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
153 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
154 |
|
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
155 |
static void check(DateFormatSymbols dfs1, DateFormatSymbols dfs2, boolean expected) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
156 |
boolean got = dfs1.equals(dfs2); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
157 |
if (got != expected) { |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
158 |
throw new RuntimeException("Test failed for DateFormatSymbols.equals(). Got: " + got + ", Expected: " + expected); |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
159 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
160 |
} |
e761c1ccd13e
8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository.
okutsu
parents:
diff
changeset
|
161 |
} |