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:
Benedikt Ritter 2015-03-13 20:53:00 +00:00
parent 8aa1b44ada
commit 04c8de2334
1 changed files with 13 additions and 16 deletions

View File

@ -263,23 +263,20 @@ public class FastDatePrinterTest {
@Test
public void testCalendarTimezoneRespected() {
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);
final String pattern = "h:mma z";
final Calendar cal = Calendar.getInstance(anotherZone);
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(anotherZone);
final String expectedValue = sdf.format(cal.getTime());
final String actualValue = FastDateFormat.getInstance(pattern).format(cal);
assertEquals(expectedValue, actualValue);
}
for (final String zone : availableZones) {
TimeZone anotherZone = TimeZone.getTimeZone(zone);
assertNotNull("Cannot find another timezone", anotherZone);
final String pattern = "h:mma z";
final Calendar cal = Calendar.getInstance(anotherZone);
final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(anotherZone);
final String expectedValue = sdf.format(cal.getTime());
final String actualValue = FastDateFormat.getInstance(pattern).format(cal);
assertEquals(expectedValue, actualValue);
}
}