Very nice Charles! 2015-04-01 6:07 GMT+02:00 <c...@apache.org>:
> Author: chas > Date: Wed Apr 1 04:07:43 2015 > New Revision: 1670560 > > URL: http://svn.apache.org/r1670560 > Log: > LANG-1104 - FastDateParserTest.testParses fails in TimeZone > America/Sao_Paulo > > Modified: > commons/proper/lang/trunk/src/changes/changes.xml > > commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java > > Modified: commons/proper/lang/trunk/src/changes/changes.xml > URL: > http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1670560&r1=1670559&r2=1670560&view=diff > > ============================================================================== > --- commons/proper/lang/trunk/src/changes/changes.xml [utf-8] (original) > +++ commons/proper/lang/trunk/src/changes/changes.xml [utf-8] Wed Apr 1 > 04:07:43 2015 > @@ -22,6 +22,7 @@ > <body> > > <release version="3.4" date="tba" description="tba"> > + <action issue="LANG-1104" type="fix" dev="chas">Parse test fails for > TimeZone America/Sao_Paulo</action> > <action issue="LANG-1103" type="add" dev="britter">Add > SystemUtils.IS_JAVA_1_9</action> > <action issue="LANG-1102" type="update" dev="britter">Make logic for > comparing OS versions in SystemUtils smarter</action> > <action issue="LANG-1091" type="update" dev="britter" due-to="Fabian > Lange">Shutdown thread pools in test cases</action> > > Modified: > commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java > URL: > http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java?rev=1670560&r1=1670559&r2=1670560&view=diff > > ============================================================================== > --- > commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java > (original) > +++ > commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java > Wed Apr 1 04:07:43 2015 > @@ -42,8 +42,8 @@ import org.junit.Test; > * @since 3.2 > */ > public class FastDateParserTest { > - private static final String SHORT_FORMAT_NOERA = "y/M/d/h/a/m/s/E/Z"; > - private static final String LONG_FORMAT_NOERA = > "yyyy/MMMM/dddd/hhhh/mmmm/ss/aaaa/EEEE/ZZZZ"; > + private static final String SHORT_FORMAT_NOERA = "y/M/d/h/a/m/s/E"; > + private static final String LONG_FORMAT_NOERA = > "yyyy/MMMM/dddd/hhhh/mmmm/ss/aaaa/EEEE"; > private static final String SHORT_FORMAT = "G/" + SHORT_FORMAT_NOERA; > private static final String LONG_FORMAT = "GGGG/" + LONG_FORMAT_NOERA; > > @@ -218,6 +218,7 @@ public class FastDateParserTest { > > private void validateSdfFormatFdpParseEquality(final String format, > final Locale locale, final TimeZone tz, final DateParser fdp, final Date > in, final int year, final Date cs) throws ParseException { > final SimpleDateFormat sdf = new SimpleDateFormat(format, locale); > + sdf.setTimeZone(tz); > if (format.equals(SHORT_FORMAT)) { > sdf.set2DigitYearStart( cs ); > } > @@ -254,6 +255,29 @@ public class FastDateParserTest { > } > } > > + // we cannot use historic dates to test timezone parsing, some > timezones have second offsets > + // as well as hours and minutes which makes the z formats a low > fidelity round trip > + @Test > + public void testTzParses() throws Exception { > + // Check that all Locales can parse the time formats we use > + for(final Locale locale : Locale.getAvailableLocales()) { > + final FastDateParser fdp= new FastDateParser("yyyy/MM/dd > z", TimeZone.getDefault(), locale); > + > + for(final TimeZone tz : new TimeZone[]{NEW_YORK, > REYKJAVIK, GMT}) { > + final Calendar cal= Calendar.getInstance(tz, > locale); > + cal.clear(); > + cal.set(Calendar.YEAR, 2000); > + cal.set(Calendar.MONTH, 1); > + cal.set(Calendar.DAY_OF_MONTH, 10); > + final Date expected= cal.getTime(); > + > + final Date actual = fdp.parse("2000/02/10 > "+tz.getDisplayName(locale)); > + Assert.assertEquals("tz:"+tz.getID()+" > locale:"+locale.getDisplayName(), expected, actual); > + } > + } > + } > + > + > @Test > public void testLocales_Long_AD() throws Exception { > testLocales(LONG_FORMAT, false); > > > -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter