Switching the JDK test to a warning as we can't control the JDK
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@504357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6733a06f09
commit
6575c54a88
|
@ -214,23 +214,28 @@ public class DateFormatUtilsTest extends TestCase {
|
|||
|
||||
public void testLang312() {
|
||||
String pattern = "dd/MM/yyyy";
|
||||
String expected = "19/04/1948";
|
||||
TimeZone timeZone = TimeZone.getTimeZone("CET");
|
||||
Locale locale = Locale.GERMANY;
|
||||
|
||||
// show Calendar is good
|
||||
Calendar cal = Calendar.getInstance(timeZone, locale);
|
||||
cal.set(1948, 3, 19);
|
||||
assertEquals("19/04/1948", DateFormatUtils.format( cal.getTime(), pattern, timeZone, locale ) );
|
||||
assertEquals(expected, DateFormatUtils.format( cal.getTime(), pattern, timeZone, locale ) );
|
||||
|
||||
Date date = new Date(48, 3, 19);
|
||||
|
||||
// test JDK
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(pattern, locale);
|
||||
sdf.setTimeZone(timeZone);
|
||||
assertEquals("19/04/1948", sdf.format( date ) );
|
||||
// There's nothing we can do if the JDK fails, so just going to pring a warning in this case
|
||||
// assertEquals(expected, sdf.format( date ) );
|
||||
if( ! expected.equals( sdf.format( date ) ) ) {
|
||||
System.out.println("WARNING: JDK test failed - testLang312()");
|
||||
}
|
||||
|
||||
// test Commons
|
||||
assertEquals("19/04/1948", DateFormatUtils.format( date, pattern, timeZone, locale ) );
|
||||
assertEquals(expected, DateFormatUtils.format( date, pattern, timeZone, locale ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue