mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-06 18:18:22 +00:00
No need to exclude the current time zone from testing
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1666575 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8aa1b44ada
commit
04c8de2334
@ -263,23 +263,20 @@ public void testTimeZoneMatches() {
|
|||||||
@Test
|
@Test
|
||||||
public void testCalendarTimezoneRespected() {
|
public void testCalendarTimezoneRespected() {
|
||||||
final String[] availableZones = TimeZone.getAvailableIDs();
|
final String[] availableZones = TimeZone.getAvailableIDs();
|
||||||
final TimeZone currentZone = TimeZone.getDefault();
|
|
||||||
|
|
||||||
for (final String zone : availableZones) {
|
|
||||||
if (!zone.equals(currentZone.getID())) {
|
|
||||||
TimeZone anotherZone = TimeZone.getTimeZone(zone);
|
|
||||||
|
|
||||||
assertNotNull("Cannot find another timezone", anotherZone);
|
for (final String zone : availableZones) {
|
||||||
|
TimeZone anotherZone = TimeZone.getTimeZone(zone);
|
||||||
final String pattern = "h:mma z";
|
|
||||||
final Calendar cal = Calendar.getInstance(anotherZone);
|
assertNotNull("Cannot find another timezone", anotherZone);
|
||||||
|
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
final String pattern = "h:mma z";
|
||||||
sdf.setTimeZone(anotherZone);
|
final Calendar cal = Calendar.getInstance(anotherZone);
|
||||||
final String expectedValue = sdf.format(cal.getTime());
|
|
||||||
final String actualValue = FastDateFormat.getInstance(pattern).format(cal);
|
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||||
assertEquals(expectedValue, actualValue);
|
sdf.setTimeZone(anotherZone);
|
||||||
}
|
final String expectedValue = sdf.format(cal.getTime());
|
||||||
|
final String actualValue = FastDateFormat.getInstance(pattern).format(cal);
|
||||||
|
assertEquals(expectedValue, actualValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user