Adding test for LANG-312. It passes for me, so I'm interested in whether it fails for anybody else.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@492910 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2007-01-05 05:30:04 +00:00
parent be732f09d7
commit abb136d51f
1 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.commons.lang.time;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
@ -211,4 +212,17 @@ public class DateFormatUtilsTest extends TestCase {
assertEquals("Sun, 08 Jun 2003 13:11:12 +0000", text);
}
public void testLang312() {
String pattern = "dd/MM/yyyy";
TimeZone timeZone = TimeZone.getTimeZone("CET");
Locale locale = Locale.GERMANY;
Calendar cal = Calendar.getInstance(timeZone, locale);
cal.set(1948, 3, 19);
assertEquals("19/04/1948", DateFormatUtils.format( cal.getTime(), pattern, timeZone, locale ) );
Date date = new Date(48, 3, 19);
assertEquals("19/04/1948", DateFormatUtils.format( date, pattern, timeZone, locale ) );
}
}