1
1
/*
2
- * Copyright (c) 2012, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2012, 2022 , 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
51
51
52
52
/*
53
53
* @test
54
- * @bug 8081022 8151876 8166875 8177819 8189784 8206980 8277049
54
+ * @bug 8081022 8151876 8166875 8177819 8189784 8206980 8277049 8278434
55
55
* @key randomness
56
56
*/
57
57
61
61
@ Test
62
62
public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
63
63
64
+ private static final Locale [] SAMPLE_LOCALES = {
65
+ Locale .US , Locale .UK , Locale .FRANCE , Locale .GERMANY , Locale .ITALY , Locale .forLanguageTag ("es" ),
66
+ Locale .forLanguageTag ("pt-BR" ), Locale .forLanguageTag ("ru" ),
67
+ Locale .CHINA , Locale .TAIWAN , Locale .JAPAN , Locale .KOREA , Locale .ROOT };
68
+
64
69
protected static DateTimeFormatter getFormatter (Locale locale , TextStyle style ) {
65
70
return new DateTimeFormatterBuilder ().appendZoneText (style )
66
71
.toFormatter (locale )
@@ -70,7 +75,6 @@ protected static DateTimeFormatter getFormatter(Locale locale, TextStyle style)
70
75
public void test_printText () {
71
76
Random r = RandomFactory .getRandom ();
72
77
int N = 8 ;
73
- Locale [] locales = Locale .getAvailableLocales ();
74
78
Set <String > zids = ZoneRulesProvider .getAvailableZoneIds ();
75
79
ZonedDateTime zdt = ZonedDateTime .now ();
76
80
@@ -85,7 +89,7 @@ public void test_printText() {
85
89
zdt = zdt .withZoneSameLocal (ZoneId .of (zid ));
86
90
TimeZone tz = TimeZone .getTimeZone (zid );
87
91
boolean isDST = tz .inDaylightTime (new Date (zdt .toInstant ().toEpochMilli ()));
88
- for (Locale locale : locales ) {
92
+ for (Locale locale : SAMPLE_LOCALES ) {
89
93
String longDisplayName = tz .getDisplayName (isDST , TimeZone .LONG , locale );
90
94
String shortDisplayName = tz .getDisplayName (isDST , TimeZone .SHORT , locale );
91
95
if ((longDisplayName .startsWith ("GMT+" ) && shortDisplayName .startsWith ("GMT+" ))
@@ -118,9 +122,8 @@ private void printText(Locale locale, ZonedDateTime zdt, TextStyle style, TimeZo
118
122
}
119
123
120
124
public void test_ParseText () {
121
- Locale [] locales = new Locale [] { Locale .ENGLISH , Locale .JAPANESE , Locale .FRENCH };
122
125
Set <String > zids = ZoneRulesProvider .getAvailableZoneIds ();
123
- for (Locale locale : locales ) {
126
+ for (Locale locale : SAMPLE_LOCALES ) {
124
127
parseText (zids , locale , TextStyle .FULL , false );
125
128
parseText (zids , locale , TextStyle .FULL , true );
126
129
parseText (zids , locale , TextStyle .SHORT , false );
0 commit comments