commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1663410 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
Date Mon, 02 Mar 2015 19:44:40 GMT
Author: sebb
Date: Mon Mar  2 19:44:39 2015
New Revision: 1663410

URL: http://svn.apache.org/r1663410
Log:
Simplify

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java?rev=1663410&r1=1663409&r2=1663410&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java
Mon Mar  2 19:44:39 2015
@@ -107,6 +107,7 @@ public class FastDateParserSDFTest {
     private final String input;
     private final Locale locale;
     private final boolean valid;
+    private final TimeZone timeZone = TimeZone.getDefault();
 
     public FastDateParserSDFTest(String format, String input, Locale locale, boolean valid)
{
         this.format = format;
@@ -117,30 +118,24 @@ public class FastDateParserSDFTest {
 
     @Test
     public void testOriginal() throws Exception {
-        final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
-        final TimeZone timeZone = TimeZone.getDefault();
-        final DateParser fdf = new FastDateParser(format, timeZone, locale);
-        checkParse(locale, sdf, fdf, input);
+        checkParse(input);
     }
 
     @Test
     public void testUpperCase() throws Exception {
-        final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
-        final TimeZone timeZone = TimeZone.getDefault();
-        final DateParser fdf = new FastDateParser(format, timeZone , locale);
-        checkParse(locale, sdf, fdf, input.toUpperCase(locale));
+        checkParse(input.toUpperCase(locale));
     }
 
     @Test
     @Ignore // not currently supported
     public void testLowerCase() throws Exception {
-        final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
-        final TimeZone timeZone = TimeZone.getDefault();
-        final DateParser fdf = new FastDateParser(format, timeZone , locale);
-        checkParse(locale, sdf, fdf, input.toLowerCase(locale));
+        checkParse(input.toLowerCase(locale));
     }
 
-    private void checkParse(final Locale locale, final SimpleDateFormat sdf, final DateParser
fdf, final String formattedDate) throws ParseException {
+    private void checkParse(final String formattedDate) throws ParseException {
+        final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
+        sdf.setTimeZone(timeZone);
+        final DateParser fdf = new FastDateParser(format, timeZone, locale);
         Date expectedTime=null;
         Class<?> sdfE = null;
         try {



Mime
View raw message