< prev index next >
test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 47,57 ****
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/*
* @test
! * @bug 8081022
* @key randomness
*/
/**
* Test ZoneTextPrinterParser
--- 47,57 ----
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/*
* @test
! * @bug 8081022 8151876
* @key randomness
*/
/**
* Test ZoneTextPrinterParser
*** 82,91 ****
--- 82,99 ----
}
zdt = zdt.withZoneSameLocal(ZoneId.of(zid));
TimeZone tz = TimeZone.getTimeZone(zid);
boolean isDST = tz.inDaylightTime(new Date(zdt.toInstant().toEpochMilli()));
for (Locale locale : locales) {
+ String longDisplayName = tz.getDisplayName(isDST, TimeZone.LONG, locale);
+ String shortDisplayName = tz.getDisplayName(isDST, TimeZone.SHORT, locale);
+ if ((longDisplayName.startsWith("GMT+") && shortDisplayName.startsWith("GMT+"))
+ || (longDisplayName.startsWith("GMT-") && shortDisplayName.startsWith("GMT-"))) {
+ printText(locale, zdt, TextStyle.FULL, tz, tz.getID());
+ printText(locale, zdt, TextStyle.SHORT, tz, tz.getID());
+ continue;
+ }
printText(locale, zdt, TextStyle.FULL, tz,
tz.getDisplayName(isDST, TimeZone.LONG, locale));
printText(locale, zdt, TextStyle.SHORT, tz,
tz.getDisplayName(isDST, TimeZone.SHORT, locale));
}
*** 193,202 ****
--- 201,213 ----
String zid, String expected, String text,
Locale locale, TextStyle style, boolean ci) {
if (ci) {
text = text.toUpperCase();
}
+ if (text.equals("")) {
+ return;
+ }
String ret = fmt.parse(text, TemporalQueries.zone()).getId();
// TBD: need an excluding list
// assertEquals(...);
if (ret.equals(expected) ||
ret.equals(zid) ||
< prev index next >