fix test to work correctly on machines where locale is en_US but date
symbols are Japanese

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6e45177d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6e45177d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6e45177d

Branch: refs/heads/LOG4J2-1161
Commit: 6e45177dd8ab5509a28d3f45312405db5edf2dd0
Parents: 59cc8e5
Author: rpopma <rpo...@apache.org>
Authored: Fri Oct 23 01:51:33 2015 +0900
Committer: rpopma <rpo...@apache.org>
Committed: Fri Oct 23 01:51:33 2015 +0900

----------------------------------------------------------------------
 .../log4j/core/util/datetime/FixedDateFormatTest.java  | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6e45177d/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
index dc222e7..8bfc6af 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.util.datetime;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.Locale;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.core.util.datetime.FixedDateFormat.FixedFormat;
@@ -68,7 +69,7 @@ public class FixedDateFormatTest {
         assertEquals("yyyyMMdd", 
FixedFormat.COMPACT.getFastDateFormat().getPattern());
         assertEquals("yyyy-MM-dd ", 
FixedFormat.DEFAULT.getFastDateFormat().getPattern());
     }
-    
+
     @Test
     public void testCreateIfSupported_nonNullIfNameMatches() {
         for (final FixedDateFormat.FixedFormat format : 
FixedDateFormat.FixedFormat.values()) {
@@ -121,7 +122,7 @@ public class FixedDateFormatTest {
         assertNull("timezone", FixedDateFormat.createIfSupported(options));
     }
 
-    @Test(expected=NullPointerException.class)
+    @Test(expected = NullPointerException.class)
     public void testConstructorDisallowsNull() {
         new FixedDateFormat(null);
     }
@@ -138,7 +139,7 @@ public class FixedDateFormatTest {
         final long start = now - TimeUnit.HOURS.toMillis(25);
         final long end = now + TimeUnit.HOURS.toMillis(25);
         for (final FixedFormat format : FixedFormat.values()) {
-            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern());
+            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern(), Locale.getDefault());
             final FixedDateFormat customTF = new FixedDateFormat(format);
             for (long time = start; time < end; time += 12345) {
                 final String actual = customTF.format(time);
@@ -154,7 +155,7 @@ public class FixedDateFormatTest {
         final long start = now - TimeUnit.HOURS.toMillis(25);
         final long end = now + TimeUnit.HOURS.toMillis(25);
         for (final FixedFormat format : FixedFormat.values()) {
-            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern());
+            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern(), Locale.getDefault());
             final FixedDateFormat customTF = new FixedDateFormat(format);
             for (long time = end; time > start; time -= 12345) {
                 final String actual = customTF.format(time);
@@ -171,7 +172,7 @@ public class FixedDateFormatTest {
         final long end = now + TimeUnit.HOURS.toMillis(25);
         final char[] buffer = new char[128];
         for (final FixedFormat format : FixedFormat.values()) {
-            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern());
+            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern(), Locale.getDefault());
             final FixedDateFormat customTF = new FixedDateFormat(format);
             for (long time = start; time < end; time += 12345) {
                 final int length = customTF.format(time, buffer, 23);
@@ -189,7 +190,7 @@ public class FixedDateFormatTest {
         final long end = now + TimeUnit.HOURS.toMillis(25);
         final char[] buffer = new char[128];
         for (final FixedFormat format : FixedFormat.values()) {
-            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern());
+            final SimpleDateFormat simpleDF = new 
SimpleDateFormat(format.getPattern(), Locale.getDefault());
             final FixedDateFormat customTF = new FixedDateFormat(format);
             for (long time = end; time > start; time -= 12345) {
                 final int length = customTF.format(time, buffer, 23);

Reply via email to