Repository: commons-lang
Updated Branches:
  refs/heads/master 775203dd2 -> 5c6a87c46


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


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6dbb48c8
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6dbb48c8
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6dbb48c8

Branch: refs/heads/master
Commit: 6dbb48c8e685f65f45ad5df9f7684bed910036c8
Parents: 775203d
Author: Benedikt Ritter <brit...@apache.org>
Authored: Fri May 1 22:04:48 2015 +0200
Committer: Benedikt Ritter <brit...@apache.org>
Committed: Fri May 1 22:04:48 2015 +0200

----------------------------------------------------------------------
 .../commons/lang3/time/DateFormatUtilsTest.java | 28 ++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6dbb48c8/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
index 425ec6c..93acc35 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
@@ -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);
+        }
     }
 
     /*

Reply via email to