Set default locale to Locale.ENGLISH to make test independent from system default locale.

This commit is contained in:
Benedikt Ritter 2015-05-01 22:04:48 +02:00
parent 775203dd2c
commit 6dbb48c8e6
1 changed files with 17 additions and 11 deletions

View File

@ -166,17 +166,23 @@ public class DateFormatUtilsTest {
}
@Test
public void testSMTP(){
TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
Calendar june = createJuneTestDate(timeZone);
assertFormats("Sun, 08 Jun 2003 10:11:12 -0300", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),
timeZone, june);
timeZone = TimeZone.getTimeZone("UTC");
june = createJuneTestDate(timeZone);
assertFormats("Sun, 08 Jun 2003 10:11:12 +0000", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),
timeZone, june);
public void testSMTP() {
Locale defaultLocale = Locale.getDefault();
try {
Locale.setDefault(Locale.ENGLISH);
TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
Calendar june = createJuneTestDate(timeZone);
assertFormats("Sun, 08 Jun 2003 10:11:12 -0300", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),
timeZone, june);
timeZone = TimeZone.getTimeZone("UTC");
june = createJuneTestDate(timeZone);
assertFormats("Sun, 08 Jun 2003 10:11:12 +0000", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),
timeZone, june);
} finally {
Locale.setDefault(defaultLocale);
}
}
/*